first thought
- DP. Using 1d array to record the maximum length of sequence of each number when the number is the last number in the sequence.
- Get the maximum number of the array.
solution
|
|
result
AC.
Follow Up
Using nlogn time complexity.
thought
- There should be some solution connecting to binary search which is O(logn).
- But the input is unsorted, so maybe it’s not to search some specific value in the input array.
- Still a little confused. Update later.