1
class Solution {
2

3
int a[];
4
int b[];
5

6
public Solution(int[] nums) {
7
a = nums.clone();
8
b = nums.clone();
9
}
10

11
public int[] reset() {
12
a = b.clone();
13
return a;
14
}
15

16
public int[] shuffle() {
17

18
for (int i = 0; i < a.length; i++) {
19
int ren = (int) (Math.random() * a.length);
20
int temp = a[ren];
21
a[ren] = a[i];
22
a[i] = temp;
23
}
24
return a;
25
}
26
}
27

28
/**
29
* Your Solution object will be instantiated and called as such: Solution obj = new Solution(nums);
30
* int[] param_1 = obj.reset(); int[] param_2 = obj.shuffle();
31
*/

0

WPM •0 •0

100%

ACC •0 •0

0s

TIME •0