Cinema Seats

Unlike the traditional cinemas, Alice's cinema has only one row, and each seat has a colour of either red, blue or green:

\[RRBRGGRBB\]

Every day, she encounters customers requesting for consecutive seats with a particular sequence of colours. To verify if the request is possible, she uses the following matching algorithm :

1
2
3
4
5
6
7
8
9
def match(customerColor, rowColor):
    if len(customerColor) > len(rowColor):
        return False
    elif customerColor == rowColor[:len(customerColor)]:
        return True
    else:
        for i in range(len(customerColor)):
            if customerColor[i] != rowColor[i]:
                return match(customerColor, rowColor[i+1:])

Which of the customer request will return false according to the algorithm but is actually true?

×

Problem Loading...

Note Loading...

Set Loading...