zip and *zip fucntions

PHOTO EMBED

Fri May 21 2021 05:32:32 GMT+0000 (Coordinated Universal Time)

Saved by @isnottom #python

class Solution:
    def minDeletionSize(self, strs: List[str]) -> int:

        count = 0
        for i in range(len(strs[0])):
            w = []
            k=[]
            for j in range(len(strs)):
                d=strs[j][i]
                w.append(d)
                k.append(d)
            k.sort()
            if k!=w:
                count+=1
        return (count)


#" using unzip "

class Solution:
    def minDeletionSize(self, A: List[str]) -> int:
        d = 0
        for col in zip(*A):
            if list(col)!=sorted(col):
                d+=1
        return d
        
content_copyCOPY

https://leetcode.com/problems/delete-columns-to-make-sorted/