problemscpp
A collection of my answers to algorithm problems in c++.
| 函数 | 变量
leetcode::shortest_path_to_get_all_keys 命名空间参考

  1. 获取所有钥匙的最短路径
更多...

struct  frame
 
class  Solution
 

函数

 TEST (shortest_path_to_get_all_keys, case1)
 
 TEST (shortest_path_to_get_all_keys, case2)
 
 TEST (shortest_path_to_get_all_keys, case3)
 
 TEST (shortest_path_to_get_all_keys, case4)
 
 TEST (shortest_path_to_get_all_keys, case5)
 

变量

constexpr char EMPTY = '.'
 
constexpr char START = '@'
 
constexpr char WALL = '#'
 

详细描述

  1. 获取所有钥匙的最短路径

函数说明

◆ TEST() [1/5]

leetcode::shortest_path_to_get_all_keys::TEST ( shortest_path_to_get_all_keys  ,
case1   
)

在文件 leetcode_test.cpp4312 行定义.

4312 {
4313 vector<string> grid = {"@.a.#", "###.#", "b.A.B"};
4314 ASSERT_EQ(8, Solution::shortestPathAllKeys(grid));
4315 }

引用了 leetcode::shortest_path_to_get_all_keys::Solution::shortestPathAllKeys().

◆ TEST() [2/5]

leetcode::shortest_path_to_get_all_keys::TEST ( shortest_path_to_get_all_keys  ,
case2   
)

在文件 leetcode_test.cpp4317 行定义.

4317 {
4318 vector<string> grid = {"@..aA", "..B#.", "....b"};
4319 ASSERT_EQ(6, Solution::shortestPathAllKeys(grid));
4320 }

引用了 leetcode::shortest_path_to_get_all_keys::Solution::shortestPathAllKeys().

◆ TEST() [3/5]

leetcode::shortest_path_to_get_all_keys::TEST ( shortest_path_to_get_all_keys  ,
case3   
)

在文件 leetcode_test.cpp4322 行定义.

4322 {
4323 vector<string> grid = {"@Aa"};
4324 ASSERT_EQ(-1, Solution::shortestPathAllKeys(grid));
4325 }

引用了 leetcode::shortest_path_to_get_all_keys::Solution::shortestPathAllKeys().

◆ TEST() [4/5]

leetcode::shortest_path_to_get_all_keys::TEST ( shortest_path_to_get_all_keys  ,
case4   
)

在文件 leetcode_test.cpp4327 行定义.

4327 {
4328 vector<string> grid = {".@aA"};
4329 ASSERT_EQ(1, Solution::shortestPathAllKeys(grid));
4330 }

引用了 leetcode::shortest_path_to_get_all_keys::Solution::shortestPathAllKeys().

◆ TEST() [5/5]

leetcode::shortest_path_to_get_all_keys::TEST ( shortest_path_to_get_all_keys  ,
case5   
)

在文件 leetcode_test.cpp4332 行定义.

4332 {
4333 vector<string> grid = {"..#....##.", "....d.#.D#", "#...#.c...", "..##.#..a.", "...#....##", "#....b....", ".#..#.....", "..........", ".#..##..A.", ".B..C.#..@"};
4334 ASSERT_EQ(19, Solution::shortestPathAllKeys(grid));
4335 }

引用了 leetcode::shortest_path_to_get_all_keys::Solution::shortestPathAllKeys().

变量说明

◆ EMPTY

constexpr char leetcode::shortest_path_to_get_all_keys::EMPTY = '.'
constexpr

在文件 leetcode.h3229 行定义.

◆ START

constexpr char leetcode::shortest_path_to_get_all_keys::START = '@'
constexpr

◆ WALL

constexpr char leetcode::shortest_path_to_get_all_keys::WALL = '#'
constexpr