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.
Look at my faster solution without explicit sort. )))
The overall time complexity of this solution is O(N!⋅NlogN).
Brute force should've been stated in the description of the code, but it does encourage people to write more efficent code.
I initally decided to generate all of the permutations and then give back the next biggest one but tests stopped me from doing that.
Not the most efficent one but probably the cleanest.
Although some comments would've helped
Not smart, but, hey-y, it works.
Oops, I missed that, sorry.
n = 199999
approximate number of operations 720000
I tried this solution trying to solve a similar kata ("Next smaller number with the same digits") and timed out
I went with a more tiny solution but I'mnot fully happy with it. It seems that this Kata wasn't very easy to anyone
Check the comments, this solution is at least 5 years old, and probably there were no random tests when it passed. Read Eldrad's comment below to see why it fails. Solutions automatic revalidation isn't working and this solution is invalid (as you could see) with random negative tests.
How can this pass? I tried to test run and it fails the random tests.
what do you mean by this? url.indexOf(p1 + '=') < qPos
Please see my solution to the problem. I think it works for such large numbers.
Damn nice. I took way too long to solve this and this looks so simple
somehow brute force but nice solution
Loading more items...