We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 136fee7 commit a59d810Copy full SHA for a59d810
C++/smallest-missing-genetic-value-in-each-subtree.cpp
@@ -10,8 +10,8 @@ class Solution {
10
return result;
11
}
12
vector<vector<int>> adj(size(parents));
13
- for (int i = 1; i < size(parents); ++i) {
14
- adj[parents[i]].emplace_back(i);
+ for (int j = 1; j < size(parents); ++j) {
+ adj[parents[j]].emplace_back(j);
15
16
unordered_set<int> lookup;
17
for (int miss = 1; i >= 0; i = parents[i]) {
@@ -30,7 +30,7 @@ class Solution {
30
31
vector<int> stk = {i};
32
while (!empty(stk)) {
33
- const int i = stk.back(); stk.pop_back();
+ i = stk.back(); stk.pop_back();
34
if (lookup->count(nums[i])) {
35
continue;
36
0 commit comments