1964. Find the Longest Valid Obstacle Course at Each Position


greedy + binary search
same as leetcode 300 LIS, but this one has the equal condition, it's Longest Non-decreasing Subsequence
and returns the Longest Non-decreasing Subsequence array of each length condition.
time: O(nlogn)
space: O(n), use a tails array
Last updated
Was this helpful?