944. Delete Columns to Make Sorted
给你一个字串阵列表示的矩阵,若该矩阵的行不是由字典序小到大排序则移除之,判断
有几个行需要移除。
Example:
Input: strs = ["cba","daf","ghi"]
Output: 1
Explanation: The grid looks as follows:
cba
daf
ghi
Columns 0 and 2 are sorted, but column 1 is not, so you only need to delete 1
column.
思路:
1.对每一个行遍历并检查是否有排序,若没排序就让removed加一。
2.返回removed。
Java Code: