aboutsummaryrefslogtreecommitdiff
path: root/min_score_path_city.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'min_score_path_city.cpp')
-rw-r--r--min_score_path_city.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/min_score_path_city.cpp b/min_score_path_city.cpp
index 5a25ec3..16f4c87 100644
--- a/min_score_path_city.cpp
+++ b/min_score_path_city.cpp
@@ -3,12 +3,12 @@
class Solution {
public:
- int minScore(int n, vvd(int) & roads) {
+ int minScore(int n, vvd & roads) {
unordered_map<int, unordered_map<int, int>> graph;
for (auto r : roads)
graph[r[0]][r[1]] = graph[r[1]][r[0]] = r[2];
unordered_set<int> vis;
- function<int(int)> dfs;
+ function<int> dfs;
dfs = [&](int n) -> int {
int res = INT_MAX;
vis.insert(n);
@@ -25,8 +25,8 @@ public:
int main() {
Solution obj;
- vvd(int) r1 = {{1, 2, 9}, {2, 3, 6}, {2, 4, 5}, {1, 4, 7}};
- vvd(int) r2 = {{1, 2, 2}, {1, 3, 4}, {3, 4, 7}};
+ vvd r1 = {{1, 2, 9}, {2, 3, 6}, {2, 4, 5}, {1, 4, 7}};
+ vvd r2 = {{1, 2, 2}, {1, 3, 4}, {3, 4, 7}};
printf("%d\n", obj.minScore(4, r1)); // expect: 5
printf("%d\n", obj.minScore(4, r2)); // expect: 2
}