grid
"."
"#"
"@"
"a"
"b"
, ...) are keys, and ("A"
"B"
, ...) are locks.
K
-1
.
Example 1:
Input: ["@.a.#","###.#","b.A.B"] Output: 8
Example 2:
Input: ["@..aA","..B#.","....b"] Output: 6
Note:
grid[i][j]
'#'
'@'
'a'-``'f``'
'A'-'F'
[1, 6]
Github 同步地址:
https://github.com/grandyang/leetcode/issues/864
参考资料:
https://leetcode.com/problems/shortest-path-to-get-all-keys/