Loading...
Loading...
Loading...
A student's marks are listed in test order. Choose some marks, keeping their order, so each chosen mark is strictly higher than the one before. Print the largest possible number of chosen marks.
Example 1
Input
5 2 8 6 3 7 9
Output
4
2, 3, 7, 9 has four marks.
Example 2
Input
4 4 4
Output
1
Try the problem first. Open one hint at a time.
Keep a sorted list tails where tails[k] is the smallest last mark of a run of length k + 1.
Use bisect_left to find the place for each mark.
Write your Python code, run it on the examples and submit it to hidden tests.
Solve in the editor