3 ms·
My code runs in O(n log n) time and can deal with repeated digits. You converted it to something that takes exponential time and chokes on repeated digits. (BT
by cousin_it 12y ago
My code runs in O(n log n) time and can deal with repeated digits. You converted it to something that takes exponential time and chokes on repeated digits.
(BTW, I just realized that my code can be made O(n), by replacing the default sort with a counting sort :-))