Tap here to switch tabs
Problem
Submissions

Problem: Delete Columns to Make Sorted II

Delete Columns to Make Sorted II asks you to remove the fewest columns from every string so the remaining strings are in lexicographical order.

Statement

You are given an array of n strings strs, where all strings are of equal length.

You may choose any set of column indices to delete. When a column index is deleted, the character at that index is removed from every string in strs.

Return the minimum number of column deletions required so that the remaining array of strings is in lexicographical order, meaning strs[0] ≤\leq strs[1] ≤⋯≤\leq \dots \leq strs[n - 1].

Constraints:

  • n ==== strs.length

  • 1≤1 \leq n ≤100\leq 100

  • 1≤1 \leq strs[i].length ≤100\leq 100

  • strs[i] consists of lowercase English letters.

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Delete Columns to Make Sorted II

Delete Columns to Make Sorted II asks you to remove the fewest columns from every string so the remaining strings are in lexicographical order.

Statement

You are given an array of n strings strs, where all strings are of equal length.

You may choose any set of column indices to delete. When a column index is deleted, the character at that index is removed from every string in strs.

Return the minimum number of column deletions required so that the remaining array of strings is in lexicographical order, meaning strs[0] ≤\leq strs[1] ≤⋯≤\leq \dots \leq strs[n - 1].

Constraints:

  • n ==== strs.length

  • 1≤1 \leq n ≤100\leq 100

  • 1≤1 \leq strs[i].length ≤100\leq 100

  • strs[i] consists of lowercase English letters.