Approach
# for
Time Complexity
n = row
m = column
O(n * m)
Space Complexity
n = row
m = column
O(n * m)
Code
class Solution {
public:
int minDeletionSize(vector<string>& strs) {
int cnt = 0;
for (int i = 0 ; i < strs[0].size(); i++) {
bool check = true;
for (int j = 1 ; j < strs.size() ; j++) {
if (strs[j][i] - strs[j - 1][i] < 0) {
check = false;
}
}
if (!check) {
cnt++;
}
}
return cnt;
}
};