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.
Thanks for the reply. I realized that I misunderstood your solution.
I got the result after transition but not the position array.
I made it!
It can be described as a shuffle as well, but that particular wording used in the Description was taken verbatim from the Wikipedia page; that page provides the historical context -- it was a method of lottery used to assign things like chores or prizes. Think of it like the game of drawing straws.
Also, added some clarity to the Description:
I'd describe it as a shuffle, rather than a lottery. It doesn't seem to create pairings between two ( possibly different? ) lists; it just shuffles its input list.
If we follow the path of the
6
, we see it ends up at the0
position, below:EDIT: pasted an image because the Discourse section, though it renders HTML code fine in the preview, will not show it as the actual comment.
EDIT #2: Each index value of the returned list/array should be occupied by the number that arrives at that position. The '6' value, after swapping all of its positions, arrives at the
0
index slot.How can 0 become 6, I thought it should be 4.
[down down right right right down down right]
And 6 becomes 4?
[left left down left left left left down]
Learn some math guys, no space occupied, operate in O(n) time.