filmov
tv
Find Common (Minimum , Greatest , SubArray) From array (array of arrays) In swift

Показать описание
To find the smallest common number in all rows of a 2D array (array of arrays), here are three solutions of increasing efficiency:
Given [[1,2,3,4,5], [2,3,5,6], [0,3,5,7]], return the smallest number present in all arrays.
Return -1 if no such number exists.
Given [[1,2,3,4,5], [2,3,5,6], [0,3,5,7]], return the smallest number present in all arrays.
Return -1 if no such number exists.