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.
Hahaha! Tried to avoid brute force as well, but alas, it's the only way I could get it right.
The difficulty is not the same in all languages...
This is a great Kata.
I took so much time to finish this, trying to avoid nested loops.
But then the top answers are all nested loops! This looks weird.
Do we have any performance metrics to pass too?
Thanks anyway. :)
Look closely, the expected result is indeed smaller.
You must have i and j smallest so with your example the good answer is only
[19, 0, 1]
.It allows more than one answer: e.g. 91 to [19, 0, 1] and [19, 1, 0]. Also there can be more than 1 answer when two same digits are in row. This breaks verification to the point "what author assummed".
This comment is hidden because it contains spoiler information about the solution
Wow! Your sleeping is efficient:-)
You don't get this kind of joy out of a stupid brute force solution if you knew beforehand that it was easy. -- i second that
My word! I was trying to invent an algo for three bloody hours! Woke up the next day and thought why not just brute-force it. KISS!