Skip to content

Commit 4e9d13a

Browse files
committed
Add 944-DeleteColumnsToMakeSorted.cpp
1 parent f6d3e57 commit 4e9d13a

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
class Solution {
2+
public:
3+
int minDeletionSize(vector<string>& strs) {
4+
int cnt(0);
5+
for(int col = 0; col < strs[0].size(); col++){
6+
bool sorted(true);
7+
for(int row = 1; sorted && row < strs.size(); row++){
8+
if(strs[row][col] < strs[row - 1][col]){sorted = false;}
9+
}
10+
cnt += !sorted;
11+
}
12+
13+
return cnt;
14+
}
15+
};

0 commit comments

Comments
 (0)