Hacker News new | ask | show | jobs
by hristov 5165 days ago
The second solution works in linear time only if one assumes that multiplication is a constant time operation. But is it really? If you look at how a processor does multiplication it becomes clear it is a O(log n) operation where n is one of the numbers being multiplied. Thus, the second solution is probably a O(nlogn) solution.
1 comments

It also requires one to assume n! can be computed. Factorials get huge very quickly.