Loading...
Loading...
Loading...
A list of marks is given. Count how many different longest strictly rising subsequences it has. Two subsequences differ if they use different positions, even if the values are equal. Print the count.
Example 1
Input
1 3 5 4 7
Output
2
1 3 5 7 and 1 3 4 7 both have four marks.
Example 2
Input
2 2 2
Output
3
Each single mark is a longest run, so there are three.
Try the problem first. Open one hint at a time.
Keep for each position the length of the longest run ending there and how many runs have that length.
When a new longer run is found, replace the count; when an equal length is found, add to it.
Write your Python code, run it on the examples and submit it to hidden tests.
Solve in the editor