Skip to content

Commit 4710c0e

Browse files
authored
Update delete-columns-to-make-sorted.py
1 parent 3672dc8 commit 4710c0e

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

Python/delete-columns-to-make-sorted.py

+18-1
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,27 @@
11
# Time: O(n * l)
22
# Space: O(1)
33

4+
class Solution(object):
5+
def minDeletionSize(self, A):
6+
"""
7+
:type A: List[str]
8+
:rtype: int
9+
"""
10+
result = 0
11+
for c in xrange(len(A[0])):
12+
for r in xrange(1, len(A)):
13+
if A[r-1][c] > A[r][c]:
14+
result += 1
15+
break
16+
return result
17+
18+
19+
# Time: O(n * l)
20+
# Space: O(n)
421
import itertools
522

623

7-
class Solution(object):
24+
class Solution2(object):
825
def minDeletionSize(self, A):
926
"""
1027
:type A: List[str]

0 commit comments

Comments
 (0)