Skip to content

Commit 24bdcdb

Browse files
refaactor 398
1 parent 251564e commit 24bdcdb

File tree

1 file changed

+0
-19
lines changed
  • src/main/java/com/fishercoder/solutions

1 file changed

+0
-19
lines changed

src/main/java/com/fishercoder/solutions/_398.java

-19
Original file line numberDiff line numberDiff line change
@@ -3,25 +3,6 @@
33
import java.util.ArrayList;
44
import java.util.List;
55

6-
/**
7-
* 398. Random Pick Index
8-
*
9-
* Given an array of integers with possible duplicates,
10-
* randomly output the index of a given target number. You can assume that the given target number must exist in the array.
11-
12-
Note:
13-
The array size can be very large. Solution that uses too much extra space will not pass the judge.
14-
15-
Example:
16-
17-
int[] nums = new int[] {1,2,3,3,3};
18-
Solution solution = new Solution(nums);
19-
20-
// pick(3) should return either index 2, 3, or 4 randomly. Each index should have equal probability of returning.
21-
solution.pick(3);
22-
23-
// pick(1) should return 0. Since in the array only nums[0] is equal to 1.
24-
solution.pick(1);*/
256
public class _398 {
267

278
//TODO: use reservoir sampling to solve it again

0 commit comments

Comments
 (0)