← 返回 amazon 的题目列表Delete Columns To Make Sorted
类型:online_judge
Given an array of strings strs composed of lowercase letters, where each string is of the same length. You need to delete some columns to make the remaining columns organized lexicographically by rows. Return the minimum number of columns you need to delete.
Examples
Input: strs = ["cba","daf","ghi"]
Output: 1
Explanation: Delete the first column.
Input: strs = ["a","b"]
Output: 0
Explanation: No need to delete any column.
Input: strs = ["zyx","wvu","tsr"]
Output: 3
Explanation: All columns need to be deleted.
Constraints
The length of strs is in the range [1, 1000].
The length of strs[i] is [1, 1000].
strs[i] is composed of lowercase letters only.
Example
Input
cba
daf
ghi