values. Pick some of its elements, keeping their order from the array (they need not be adjacent), so that every next number is strictly greater than the previous one.
Find the greatest possible length of such a selection and return how many rising selections of that length exist. Selections are told apart by the positions they use, not by their values.values=[3, 1, 4, 2, 5] → 3
The greatest length is 3, and there are three such selections: [3, 4, 5], [1, 4, 5] and [1, 2, 5].
values=[7, 7, 7] → 3
The growth must be strict, so the longest selection is a single number, and it can be picked in three ways.
values=[1, 2, 3] → 1
values) ≤ 2000values[i] ≤ 10⁶values=[3, 1, 4, 2, 5]
3
Run checks the first 3 tests in your browser. Submit checks all 112 tests on the server, hidden ones included.