Skip to content

Latest commit

 

History

History
41 lines (30 loc) · 1.08 KB

_1399. Count Largest Group.md

File metadata and controls

41 lines (30 loc) · 1.08 KB

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

Back to top


First completed : April 23, 2025

Last updated : April 23, 2025


Related Topics : Hash Table, Math

Acceptance Rate : 66.52 %


Solutions

Python

class Solution:
    def countLargestGroup(self, n: int) -> int:
        return (output := Counter(Counter([sum(map(int, str(x))) for x in range(1, n + 1)]).values()))[max(output.keys())]
class Solution:
    def countLargestGroup(self, n: int) -> int:
        gps = Counter([sum(map(int, str(x))) for x in range(1, n + 1)])
        output = Counter(gps.values())
        return output[max(output.keys())]