The input is a list of integers and an integer k. The output has to be the length of the longest possible increasing subsequence of contiguous elements(neighbor elements, for example in '1 0 2' 1 and 2 cannot be part of the same subsequence).
I managed to do better with Greedy, but a couple of cases were quite harsh:
1 2 3 4 4 5 6 7 8
1
output - 8 (with one 4 deleted, we get '3 4 5 6 7 8')
1 2 3 4 5 0 5 6 7 3
5
output - 7 (1..7)
Can you help me understand what rules should the algorithm respect to succeed?
I am working in Python.
I managed to do good with Greedy, but a couple of cases were quite harsh..
With Dynamic Programming I tried a 2D array, one for each element and k more rows, so dp[i][j] shows the best until position i and with j deletions.