You have a French deck of cards that sorted like this: 2 - 10, Princes, Queens, Kings, Aces.
The deck represented with array of numbers from 1 to 52(included)
Now the dealer is shuffling the deck 3 times and inserting a Joker in a random position of the deck.
The joker represented with the number 0
The idea of shuffling is slicing the array in random position and moving it to the front like in the next examples:
- 1,2,3,4,5,6,7,8,9,10 -> 6,7,8,9,10,1,2,3,4,5 // Sliced at 6
- 1,2,3,4,5,6,7,8,9,10 -> 8,9,10,1,2,3,4,5,6,7 // Sliced at 8
Find the joker position in the array. The challenge is doing this without iterating over the entire deck.
- Best time performance
- Shortest code