Tap here to switch tabs
Problem
Submissions

Problem: Delete Columns to Make Sorted

med
30 min
Try to solve the Delete Columns to Make Sorted problem.

Statement

You are given an array of n strings strs, where each string has the same length.

These strings can be arranged into a grid, with each string placed on a separate row.

You want to identify all columns that are not sorted lexicographically from top to bottom.

Return the total number of columns that must be deleted so that every remaining column is lexicographically sorted.

Constraints:

  • n == strs.length

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

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

  • strs[i] consists of lowercase English letters.

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Delete Columns to Make Sorted

med
30 min
Try to solve the Delete Columns to Make Sorted problem.

Statement

You are given an array of n strings strs, where each string has the same length.

These strings can be arranged into a grid, with each string placed on a separate row.

You want to identify all columns that are not sorted lexicographically from top to bottom.

Return the total number of columns that must be deleted so that every remaining column is lexicographically sorted.

Constraints:

  • n == strs.length

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

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

  • strs[i] consists of lowercase English letters.