HTMLify
LeetCode - Convert an Array Into a 2D Array With Conditions - Python
Views: 484 | Author: abh
1 2 3 4 5 6 7 8 9 10 11 12 13 | class Solution: def findMatrix(self, nums: List[int]) -> List[List[int]]: mat = [] for n in nums: put = False for row in mat: if not n in row: row.append(n) put = True break if not put: mat.append([n]) return mat |