Back to course home
0% completed
Vote For New Content
Minimum Deletions to Make a Sequence Sorted
Problem Statement
Given a number sequence, find the minimum number of elements that should be deleted to make the remaining sequence sorted.
Example 1:
Input: {4,2,3,6,10,1,12} Output: 2 Explanation: We need to delete {4,1} to make the remaing sequence sorted {2,3,6,10,12}.
Example 2:
Input: {-4,10,3,7,15} Output: 1 Explanation: We need to delete {10} to make the remaing sequence sorted {-4,3,7,15}.
Example 3:
Input: {3,2,1,0} Output: 3 Explanation: Since the elements are in reverse order, we have to delete all except one to get a sorted sequence
.....
.....
.....
Like the course? Get enrolled and start learning!
On this page