Skip to content

Commit a8a1d6f

Browse files
committed
Time: 98 ms (47.41%), Space: 20.2 MB (7.66%) - LeetHub
1 parent 21acc03 commit a8a1d6f

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
class Solution {
2+
public:
3+
int minDeletionSize(vector<string>& strs) {
4+
5+
int n = strs.size();
6+
int m = strs[0].size();
7+
int ans = 0;
8+
9+
for(int i = 0;i<m; ++i)
10+
{
11+
string str;
12+
for(int j = 0; j <n; ++j)
13+
{
14+
str += strs[j][i];
15+
}
16+
17+
string sortedStr = str;
18+
sort(sortedStr.begin(),sortedStr.end());
19+
20+
if(str != sortedStr)
21+
++ans;
22+
}
23+
24+
return ans;
25+
}
26+
};

0 commit comments

Comments
 (0)