Can someone clarify why for n=10 the solution
5 1 2 3 4 10 9 8 7 6
works, however 10 1 2 3 4 9 8 7 6 5
does not work?
LIS of P = 10 1 2 3 4 9 8 7 6 5 = 5 (1, 2, 3, 4, 9 / 8 / 7 / 6 / 5)
LIS of P^R = 5 6 7 8 9 4 3 2 1 10 = 6 (5, 6, 7, 8, 9, 10)
Subsequence need not be consecutive.
1 Like
Subsequence need not be consecutive, whereas the subarray should be consecutive.