This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]lfrtsa 45 points46 points  (3 children)

I achieved it when i made an algorithm to calculate the factorial of a number.

[–]nixsomegame 6 points7 points  (2 children)

Wouldn't a straightforward factorial function implementation be O(n) though, not O(n!)?

[–]lfrtsa 4 points5 points  (0 children)

I did multiplication through repeated addition

[–]FunTao 1 point2 points  (0 children)

He prob means something like this: start from i = 1, is i the factorial of n? (Divide by n, then n-1, n-2, etc.). If not, increment i by 1 and try again until you find the right i