Delete Columns to Make Sorted LeetCode solution in C++

1
class Solution {
2
public:
3
int minDeletionSize(vector<string> &strs) {
4
int col = strs[0].size();
5
int row = strs.size();
6
int count = 0;
7
for (int c = 0; c < col; c++) {
8
for (int r = 1; r < row; r++) {
9
if (strs[r][c] - strs[r - 1][c] < 0) {
10
count++;
11
break;
12
}
13
}
14
}
15
return count;
16
}
17
};

0

WPM •0 •0

100%

ACC •0 •0

0s

TIME •0