Re:Multiplication: Finding the Greatest Product
by cousin_it on Saturday November 01, 2014 @10:35PM
(#8545389)
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 :-))
Re:Multiplication: Finding the Greatest Product
by Strilanc on Saturday November 01, 2014 @11:49PM
(#8545559)
Hm, embarrassing, I just assumed you were doing the naive brute force. You're de-interleaving the digits with an order swap when the digits first start to differ.
(BTW, I just realized that my code can be made O(n), by replacing the default sort with a counting sort :-))