Why is Maximum required from the dp array?


#1

I am confused as to why do I need to take the maximum from my dp array? Shouldn’t taking dp[n-1] suffice ?


#2

dp[i] represents the length of increasing sub sequence ending at ith index it is not guaranteed that our increasing sequence contains last index for example the min of array is present at last index