Skip to content

Commit ecfad57

Browse files
Time: 122 ms (5.01%) | Memory: 17.4 MB (5.17%) - LeetSync
1 parent 931abbf commit ecfad57

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
class Solution:
2+
def findMatrix(self, nums: List[int]) -> List[List[int]]:
3+
n = len(nums)
4+
maxi = 0
5+
d = {}
6+
for i in nums:
7+
d[i] = d.get(i, 0) + 1
8+
maxi = max(maxi, d[i])
9+
ans = [[] for _ in range(maxi)]
10+
for i in d:
11+
val = d[i]
12+
for j in range(val):
13+
ans[j].append(i)
14+
15+
return ans

0 commit comments

Comments
 (0)