Intuitive Python 3 solution


#1

class Solution:
# @param A : list of list of integers
# @return a list of list of integers

def diagonal(self, A):
    arr=[]
    visit=set()
    for i in range(0,len(A)):
        for j in range(0,len(A[0])):
            if((i,j) not in visit):
                D=[]
                p=i
                q=j
                while(p<len(A) and q>=0):
                    D.append(A[p][q])
                    visit.add((p,q))
                    p+=1
                    q-=1
                arr.append(D)
            else:
                continue
    return(arr)