Skip to content

Commit d7afc35

Browse files
authored
Update subtree-removal-game-with-fibonacci-tree.cpp
1 parent 46a691f commit d7afc35

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

C++/subtree-removal-game-with-fibonacci-tree.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class Solution {
2626
class Solution2 {
2727
public:
2828
bool findGameWinner(int n) {
29-
vector<int> grundy = {0, 1};
29+
vector<int> grundy = {0, 1}; // 0-indexed
3030
for (int i = 2; i < n; ++i) {
3131
grundy[i % 2] = (grundy[(i - 1) % 2] + 1) ^ (grundy[(i - 2) % 2] + 1); // colon principle, replace the branches by a non-branching stalk of length equal to their nim sum
3232
}

0 commit comments

Comments
 (0)