Skip to content

Commit 6adfddb

Browse files
refactor 380
1 parent 5bdcfd7 commit 6adfddb

File tree

1 file changed

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

1 file changed

+0
-34
lines changed

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

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -6,40 +6,6 @@
66
import java.util.Map;
77
import java.util.Random;
88

9-
/**
10-
* 380. Insert Delete GetRandom O(1)
11-
* Design a data structure that supports all following operations in average O(1) time.
12-
*
13-
* insert(val): Inserts an item val to the set if not already present.
14-
* remove(val): Removes an item val from the set if present.
15-
* getRandom: Returns a random element from current set of elements. Each element must have the same probability of being returned.
16-
* Example:
17-
*
18-
* // Init an empty set.
19-
* RandomizedSet randomSet = new RandomizedSet();
20-
*
21-
* // Inserts 1 to the set. Returns true as 1 was inserted successfully.
22-
* randomSet.insert(1);
23-
*
24-
* // Returns false as 2 does not exist in the set.
25-
* randomSet.remove(2);
26-
*
27-
* // Inserts 2 to the set, returns true. Set now contains [1,2].
28-
* randomSet.insert(2);
29-
*
30-
* // getRandom should return either 1 or 2 randomly.
31-
* randomSet.getRandom();
32-
*
33-
* // Removes 1 from the set, returns true. Set now contains [2].
34-
* randomSet.remove(1);
35-
*
36-
* // 2 was already in the set, so return false.
37-
* randomSet.insert(2);
38-
*
39-
* // Since 2 is the only number in the set, getRandom always return 2.
40-
* randomSet.getRandom();
41-
*/
42-
439
public class _380 {
4410

4511
public static class Solution1 {

0 commit comments

Comments
 (0)