Skip to content

Commit ffa3de1

Browse files
authored
Update subtree-removal-game-with-fibonacci-tree.py
1 parent d7afc35 commit ffa3de1

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Python/subtree-removal-game-with-fibonacci-tree.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ def findGameWinner(self, n):
3131
:type n: int
3232
:rtype: bool
3333
"""
34-
grundy = [0, 1]
34+
grundy = [0, 1] # 0-indexed
3535
for i in xrange(2, n):
3636
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
3737
return grundy[(n-1)%2]

0 commit comments

Comments
 (0)