Leetcode 981 Solution
This article provides solution to leetcode question 981 (delete-columns-to-make-sorted)
Access this page by simply typing in "lcs 981" in your browser address bar if you have bunnylol configured.
Leetcode Question Link
https://leetcode.com/problems/delete-columns-to-make-sorted
Solution
class Solution:
def minDeletionSize(self, A: List[str]) -> int:
n = len(A[0])
ans = 0
for i in range(n):
cur = 'a'
for word in A:
if word[i] < cur:
ans += 1
break
cur = word[i]
return ans