1399. Count Largest Group
All prompts are owned by LeetCode. To view the prompt, click the title link above.
First completed : April 23, 2025
Last updated : April 23, 2025
Related Topics : Hash Table, Math
Acceptance Rate : 66.52 %
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())]