Skip to content

Commit 90afbd8

Browse files
committed
feat: exclude deadends
1 parent d1cda2e commit 90afbd8

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

open_the_lock/src/lib.rs

+3
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ impl Solution {
2828

2929
pub fn open_lock(deadends: Vec<String>, target: String) -> i32 {
3030
let mut marked = vec![false; 10000];
31+
for d in deadends {
32+
marked[d.parse::<usize>().unwrap()] = true;
33+
}
3134
let mut queue = vec![];
3235
let mut depth = 0;
3336
queue.push("0000".to_string());

0 commit comments

Comments
 (0)