Delete Columns to Make Sorted LeetCode solution in Python
1# Runtime: 330 ms (Top 23.27%) | Memory: 14.6 MB (Top 66.82%)234class Solution:5def minDeletionSize(self, strs: List[str]) -> int:67cols = {}8l = len(strs)9l_s = len(strs[0])10delete = set()11for i in range(l):12for col in range(l_s):13if col in cols:14if cols[col] > strs[i][col]:15delete.add(col)16cols[col] = strs[i][col]17return len(delete)