It seemed that Spotify only let you click big green SHUFFLE PLAY button if you are not premium user.
Java
1 - Fisher–Yates shuffle
1 | import java.util.Random; |
Submission Detail
- 10 / 10 test cases passed.
- Runtime: 210 ms
- Your runtime beats 38.29 % of java submissions.
2 the Knuth (or Fisher-Yates) shuffling algorithm
© Robert Sedgewick and Kevin Wayne
Proposition. [Fisher-Yates 1938] Knuth shuffling algorithm produces a uniformly random permutation of the input array in linear time.
1 | class Solution { |
Submission Detail
- 10 / 10 test cases passed.
- Runtime: 76 ms, faster than 76.75% of Java online submissions for Shuffle an Array.
- Memory Usage: 47.2 MB, less than 6.24% of Java online submissions for Shuffle an Array.
3 - Collections.shuffle
1 | import java.util.Arrays; |
Submission Detail
- 10 / 10 test cases passed.
- Runtime: 141 ms
- Your runtime beats 96.48 % of java submissions.