← ALL NOTES
Hash Table

1399. Count Largest Group

Numbers 1..n are grouped by their digit sum; find how many groups have the maximum size. Since digit sums are small (≤36 for n up to 10⁴), there are few groups, and two passes settle it: count group…

Loading…