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.
yep, but if you've already mastered all the logic behind the simple permutation, sometimes using a stl function would come with less TC compared to coding on your own. This solution provides some insights with me, though I still deem it cheating XD
I meant O(n log(n)). And considering the number of people complaining about timeouts, they wrote a O(n^2) one.
You didn't write a O(log n) solution.
That's a cheating!)
How it work?
what is going on its just a sum mate
Aah yes, sort. I tried using next_permutation, but I don't think it works with an unsorted string. Nice one!
This is the Enterprise way.
Darn, I should've looked for a library function when Knuth said that people often want all the permutations :D
*yawn... no recursion
:D
thank you for pointing this out
Not sure if possible, but you could perhaps #define while cheat_detection(); while
It doesn't matter that that turns it into two statements, just as long as the cheat_detection() is called you will (silently) fail the test. Be sure to VERY CLEARLY state that 'while' is not allowed to be used ;).
If people know you do this they can work around it, of course.
How the hell do you write an O(log n) algorithm for a function with n integer inputs...
I am not happy. I spent a lot of time on writing a solution that is O(log(n)) because the description said it was necessary to write an efficient algorithm (and it should be); then I find out that everyone else wrote a simplistic O(n) "solution" and got away with it. :/ That is not right.
Loading more items...