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. :)
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".
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!