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

  1. 矩阵中的最长递增路径
更多...

class  Solution
 

函数

 TEST (longest_increasing_path_in_a_matrix, case1)
 
 TEST (longest_increasing_path_in_a_matrix, case2)
 
 TEST (longest_increasing_path_in_a_matrix, case3)
 
 TEST (longest_increasing_path_in_a_matrix, case4)
 

详细描述

  1. 矩阵中的最长递增路径

函数说明

◆ TEST() [1/4]

leetcode::longest_increasing_path_in_a_matrix::TEST ( longest_increasing_path_in_a_matrix  ,
case1   
)

在文件 leetcode_test.cpp4227 行定义.

4227 {
4228 vector<vector<int>> matrix = {{9, 9, 4}, {6, 6, 8}, {2, 1, 1}};
4229 Solution sol{};
4230 ASSERT_EQ(4, sol.longestIncreasingPath(matrix));
4231 }

◆ TEST() [2/4]

leetcode::longest_increasing_path_in_a_matrix::TEST ( longest_increasing_path_in_a_matrix  ,
case2   
)

在文件 leetcode_test.cpp4233 行定义.

4233 {
4234 vector<vector<int>> matrix = {{3, 4, 5}, {3, 2, 6}, {2, 2, 1}};
4235 Solution sol{};
4236 ASSERT_EQ(4, sol.longestIncreasingPath(matrix));
4237 }

◆ TEST() [3/4]

leetcode::longest_increasing_path_in_a_matrix::TEST ( longest_increasing_path_in_a_matrix  ,
case3   
)

在文件 leetcode_test.cpp4239 行定义.

4239 {
4240 vector<vector<int>> matrix = {{1}};
4241 Solution sol{};
4242 ASSERT_EQ(1, sol.longestIncreasingPath(matrix));
4243 }

◆ TEST() [4/4]

leetcode::longest_increasing_path_in_a_matrix::TEST ( longest_increasing_path_in_a_matrix  ,
case4   
)

在文件 leetcode_test.cpp4245 行定义.

4245 {
4246 vector<vector<int>> matrix = {{0, 1, 2, 3, 4, 5, 6, 7, 8, 9}, {19, 18, 17, 16, 15, 14, 13, 12, 11, 10}, {20, 21, 22, 23, 24, 25, 26, 27, 28, 29}, {39, 38, 37, 36, 35, 34, 33, 32, 31, 30}, {40, 41, 42, 43, 44, 45, 46, 47, 48, 49}, {59, 58, 57, 56, 55, 54, 53, 52, 51, 50}, {60, 61, 62, 63, 64, 65, 66, 67, 68, 69}, {79, 78, 77, 76, 75, 74, 73, 72, 71, 70}, {80, 81, 82, 83, 84, 85, 86, 87, 88, 89}, {99, 98, 97, 96, 95, 94, 93, 92, 91, 90}, {100, 101, 102, 103, 104, 105, 106, 107, 108, 109}, {119, 118, 117, 116, 115, 114, 113, 112, 111, 110}, {120, 121, 122, 123, 124, 125, 126, 127, 128, 129}, {139, 138, 137, 136, 135, 134, 133, 132, 131, 130}, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}};
4247 Solution sol{};
4248 ASSERT_EQ(140, sol.longestIncreasingPath(matrix));
4249 }