File tree Expand file tree Collapse file tree 1 file changed +0
-34
lines changed
src/main/java/com/fishercoder/solutions Expand file tree Collapse file tree 1 file changed +0
-34
lines changed Original file line number Diff line number Diff line change 5
5
import java .util .Queue ;
6
6
import java .util .Set ;
7
7
8
- /**
9
- * 379. Design Phone Directory
10
- *
11
- * Design a Phone Directory which supports the following operations:
12
-
13
- get: Provide a number which is not assigned to anyone.
14
- check: Check if a number is available or not.
15
- release: Recycle or release a number.
16
- Example:
17
-
18
- // Init a phone directory containing a total of 3 numbers: 0, 1, and 2.
19
- PhoneDirectory directory = new PhoneDirectory(3);
20
-
21
- // It can return any available phone number. Here we assume it returns 0.
22
- directory.get();
23
-
24
- // Assume it returns 1.
25
- directory.get();
26
-
27
- // The number 2 is available, so return true.
28
- directory.check(2);
29
-
30
- // It returns 2, the only number that is left.
31
- directory.get();
32
-
33
- // The number 2 is no longer available, so return false.
34
- directory.check(2);
35
-
36
- // Release number 2 back to the pool.
37
- directory.release(2);
38
-
39
- // Number 2 is available again, return true.
40
- directory.check(2);
41
- */
42
8
public class _379 {
43
9
44
10
public static class Solution1 {
You can’t perform that action at this time.
0 commit comments