Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
galaxy brain
creative approach
Thank you for the laugh 🤣
300 IQ 🤯
this is not the best way in coding but the funny part it's the best way from the time complexity
Ridiculous troll with the best solution
most inefficient and retarded way to do this
the most douche way to do it, but still works so 6/10 i guess
Not a best practice. Storing values in key-value object gives better performance rather than multiple ifs, isn't it?
imagine having 1! through 12! memorized and walking into this interview question and being like... do you want me to refactor this to O(1) ?
Good since O(1) solution.
Love it. It's not even in order. This is true madness. 10/10 solution.
....and he just did the work for the computer LOL
It's not even in order!!! LMAO!!!
11/10 solution
Thw way I understand this is that if-else statements only add a constant factor to the time complexity. In this case, we only have if-else statements and we only need a single operation to return the factorial. We don't do comparisons in order from 1-12 to find the factorial of a given n.
I could argue that this algorithm has a tight-bound theta(1). Obviously you could argue that it has O(n) upper-bound, but who cares about upper-bounds when we have tight-bounds.
Loading more items...