educative.io

Educative

Wrong output for last test case

A user asked us the following question:

Message: A = [5, 4, 3, 2, 1] For the above mentioned test case the output should be None but it’s showing 5

This is Alina from Educative.

According to the statement mentioned in the lesson, the bitonic sequence is as follows:

A bitonic sequence is a sequence of integers such that:
x0 < … < xk > … > xn-1 for some k, 0 <= k < n

You can see that k can be greater than or equal to 0 but has to be less than n. This implies that xk can also be x0 and thus the sequence [5, 4, 3, 2, 1] can be seen as xk > … > xn-1 .

1 Like