Skip to content

Latest commit

 

History

History
55 lines (39 loc) · 1.24 KB

File metadata and controls

55 lines (39 loc) · 1.24 KB

2610. Question 2610

All prompts are owned by LeetCode. To view the prompt, click the title link above.

Back to top


First completed : June 07, 2024

Last updated : July 04, 2024


Related Topics : N/A

Acceptance Rate : Unknown


Cause funny python "1" (2) liner


Solutions

Python

class Solution:
    def findMatrix(self, nums: List[int]) -> List[List[int]]:
        cnt = Counter(nums)
        return [[x for x in cnt if cnt.get(x) >= c] for c in range(1, max(cnt.values()) + 1)]
class Solution:
    def findMatrix(self, nums: List[int]) -> List[List[int]]:
        cnt = Counter(nums)
        maxx = max(cnt.values())
        output = []
        for i in range(maxx) :
            output.append([])
        for i in cnt :
            for j in range(cnt.get(i)) :
                output[j].append(i)

        return output