Quant Memo
Coding/●●●●●

Group numbers with the same digits

Given a list of positive integers, group together all numbers that use exactly the same multiset of digits (same digits, any order).

nums = [12, 21, 122, 212, 221, 3]
-> [[12, 21], [122, 212, 221], [3]]

Return the groups (any order). Aim for better than the O(n2)O(n^2) all-pairs comparison.

Your answer

This one is open-ended. Work it through, then check your reasoning against the full solution.

More Coding questions