You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Approach problem from a different way: think about the maximum amount that
can be kept from 1 to i.
Then break it down with dynamic programming: with each new i, if we haven't seen it before, we must keep it. If we have seen it before, we can delete the segment that leaves with the shortest amount of kept elements.