-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
deletes columns in list to make it sorted
- Loading branch information
1 parent
8987ced
commit 25daafb
Showing
1 changed file
with
19 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
class Solution(object): | ||
def minDeletionSize(self, strs): | ||
""" | ||
:type strs: List[str] | ||
:rtype: int | ||
""" | ||
count = 0 | ||
removal = [] | ||
x = list(range(len(strs[0]))) | ||
for row_num in range(len(strs)): | ||
for col_num in x: | ||
if row_num > 0: | ||
if strs[row_num][col_num] < strs[row_num-1][col_num]: | ||
removal.append(col_num) | ||
count += 1 | ||
x = [elem for elem in x if elem not in removal] | ||
#removal = [] | ||
#print(removal) | ||
return count |