O(len(min(A))*N)


#1

O(len(min(A))*N) can run