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.
facepalm Thank you!
You misunderstood the input with the output, the input is
"8"
and the ouput is["5", "7", "8", "9", "0"]
I'm confused on how you get the final answer. Given [5,7,8,9,0] from one of the example tests, how do you get 8? There's certainly more than 8 possible permutations.
If these are the mappings based on digits adjacent neighbors:
1: ['1', '2', '4'],
2: ['1', '2', '5', '3'],
3: ['2', '3', '6'],
4: ['1', '4', '5', '7'],
5: ['2', '4', '5', '8', '6'],
6: ['3', '5', '6', '9'],
7: ['4', '7', '8'],
8: ['5', '7', '8', '0', '9'],
9: ['6', '8', '9'],
0: ['0', '8']
Then you could have the possible permutations:
1.) [5, 4, 8, 9, 0]
2.) [5, 4, 8, 9, 8]
3.) [5, 4, 8, 6, 0]
4.) [5, 4, 8, 6, 8]
5.) [5, 4, 8, 8, 0]
6.) [5, 4, 8, 8, 8]
7.) [5, 4, 5, 9, 0]
8.) [5, 4, 5, 9, 8]
9.) [5, 4, 5, 6, 0]
10.) [5, 4, 5, 6, 8]
etc, etc.
[5, (4,7,8), (8,5,7,0,9), (9,6,8), (0,8)]
[2, (4,7,8), (8,5,7,0,9), (9,6,8), (0,8)]
[4, (4,7,8), (8,5,7,0,9), (9,6,8), (0,8)]
[8, (4,7,8), (8,5,7,0,9), (9,6,8), (0,8)]
[6, (4,7,8), (8,5,7,0,9), (9,6,8), (0,8)]
So how does 8 become the final answer?
Couldn't understand the description. Although of course it may be due to the fact that I translate by Google.
Suddenly notice someone approved it, thank you for your translation.
Thank you for your reply.
To work out the amount of boxes needed is the puzzle for this kata.
If I give the whole procedure of how to get the needed amount, it lost the point.
The example is just intended to show the procedure of how boxes moving work, then from there one can work on the amount for it.
Not a bad one. I think the example walkthrough can be way more clear. Like even after solving it, I'm still not sure how starting with the solution (2,2) aids in understanding. I had to just go through the other examples and write it out to figure out my solution. Maybe something like: So for example, lets say you have lst = [1,2,3,4]. Think of the first 2 indices as the start of the left and right side. So starting from left to right, we have 1 box (lst[0]) on the left going to the right (lst[1]). So now we have (0, 3) where 0 is the left and 3 is the right. Now it's time to go from right to left. The next amount of boxes to move comes from index lst[1] since we are now going through each move operation in lst. So now we are moving 2 (lst[1]) from the right side, 3, to the left side, 0. So we get (2, 1). Find the amount of additional boxes needed if the current amount of required boxes lst[i] operation (left or right movement) is short for the current side.