Given an array, find minimum deletions to make it sorted (non-decreasing). observation: keep the longest non-decreasing subsequence, delete the rest.
Answer = . For non-decreasing (allowing equal elements), modify LIS: use instead of in the comparison. Example: . Longest non-decreasing: length . Deletions: . The answer is simply length. Any element not in the LIS must be removed.