Skip to content

Commit e587ad5

Browse files
authored
Update maximum-path-quality-of-a-graph.cpp
1 parent 00054a5 commit e587ad5

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

C++/maximum-path-quality-of-a-graph.cpp

+1-4
Original file line numberDiff line numberDiff line change
@@ -120,10 +120,7 @@ class Solution3 {
120120
if (++(*lookup)[u] == 1) {
121121
total += values[u];
122122
}
123-
int result = 0;
124-
if (!u) {
125-
result = max(result, total);
126-
}
123+
int result = !u ? total : 0;
127124
for (const auto& [v, t] : adj[u]) {
128125
if ((*lookup2)[u].count(v) || time < t) { // same directed edge won't be visited twice
129126
continue;

0 commit comments

Comments
 (0)