values. Check whether you can pick three elements at indices i < j < k whose values strictly increase: values[i] < values[j] < values[k]. The elements don't have to be adjacent.
Return True if such a trio exists and False otherwise.
Try to do it in a single pass with O(1) extra memory.values=[7, 3, 8, 1, 2, 5] → True
Indices 3, 4, 5 work, for example: 1 < 2 < 5.
values=[4, 4, 4, 4] → False
Equal values do not count as rising.
values=[9, 2, 10, 1, 3] → False
There are rising pairs (2 < 10, 1 < 3), but no third element extends any of them.
values=[7, 3, 8, 1, 2, 5]
True
Run checks the first 3 tests in your browser. Submit checks all 127 tests on the server, hidden ones included.