Below is a wrong way to make the simple logic, look complex one.
If you are planning to make your simple implementation, as a complex one then only do such wrong way of coding.
If you are planning to make your simple implementation, as a complex one then only do such wrong way of coding.
300. Longest Increasing Subsequence
Easy to understand solution
Now we know the approach, so if we see then we don't need a separate array 'counts' either.
We can do the same operations in the provided array, if we can update this array & that way we can save extra space also.
We can do the same operations in the provided array, if we can update this array & that way we can save extra space also.
Saving the space