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

  1. 与目标颜色间的最短距离
更多...

class  Solution
 

函数

 TEST (shortest_distance_to_target_color, case1)
 
 TEST (shortest_distance_to_target_color, case2)
 

详细描述

  1. 与目标颜色间的最短距离

函数说明

◆ TEST() [1/2]

leetcode::shortest_distance_to_target_color::TEST ( shortest_distance_to_target_color  ,
case1   
)

在文件 leetcode_test.cpp3552 行定义.

3552 {
3553 vector colors = {1, 1, 2, 1, 3, 2, 2, 3, 3};
3554 vector<vector<int>> queries = {{1, 3}, {2, 2}, {6, 1}};
3555 const vector ans = {3, 0, 3};
3556 ASSERT_EQ(ans, Solution::shortestDistanceColor(colors, queries));
3557 }

引用了 leetcode::shortest_distance_to_target_color::Solution::shortestDistanceColor().

◆ TEST() [2/2]

leetcode::shortest_distance_to_target_color::TEST ( shortest_distance_to_target_color  ,
case2   
)

在文件 leetcode_test.cpp3559 行定义.

3559 {
3560 vector colors = {1, 2};
3561 vector<vector<int>> queries = {{0, 3}};
3562 const vector ans = {-1};
3563 ASSERT_EQ(ans, Solution::shortestDistanceColor(colors, queries));
3564 }

引用了 leetcode::shortest_distance_to_target_color::Solution::shortestDistanceColor().