Skip to content

Commit 312dcaf

Browse files
refactor 841
1 parent 1bee83c commit 312dcaf

File tree

1 file changed

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

1 file changed

+0
-30
lines changed

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

-30
Original file line numberDiff line numberDiff line change
@@ -6,36 +6,6 @@
66
import java.util.Queue;
77
import java.util.Set;
88

9-
/**
10-
* 841. Keys and Rooms
11-
*
12-
* There are N rooms and you start in room 0.
13-
* Each room has a distinct number in 0, 1, 2, ..., N-1, and each room may have some keys to access the next room.
14-
* Formally, each room i has a list of keys rooms[i], and each key rooms[i][j] is an integer in [0, 1, ..., N-1] where N = rooms.length.
15-
* A key rooms[i][j] = v opens the room with number v.
16-
* Initially, all the rooms start locked (except for room 0).
17-
* You can walk back and forth between rooms freely.
18-
* Return true if and only if you can enter every room.
19-
*
20-
* Example 1:
21-
* Input: [[1],[2],[3],[]]
22-
* Output: true
23-
* Explanation:
24-
* We start in room 0, and pick up key 1.
25-
* We then go to room 1, and pick up key 2.
26-
* We then go to room 2, and pick up key 3.
27-
* We then go to room 3. Since we were able to go to every room, we return true.
28-
*
29-
* Example 2:
30-
* Input: [[1,3],[3,0,1],[2],[0]]
31-
* Output: false
32-
* Explanation: We can't enter the room with number 2.
33-
*
34-
* Note:
35-
* 1 <= rooms.length <= 1000
36-
* 0 <= rooms[i].length <= 1000
37-
* The number of keys in all rooms combined is at most 3000.
38-
* */
399
public class _841 {
4010
public static class Solution1 {
4111
public boolean canVisitAllRooms(List<List<Integer>> rooms) {

0 commit comments

Comments
 (0)