Skip to content

Commit

Permalink
Fixed typo
Browse files Browse the repository at this point in the history
  • Loading branch information
bjorn-martinsson committed Sep 25, 2023
1 parent 4d787b8 commit ec69341
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions pyrival/graphs/binary_lifting_on_tree.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,10 @@ def distance(self, a, b):

def kth_ancestor(self, a, k):
parent = self.parent
d = self.depth[a]
if d < k:
if self.depth[a] < k:
return -1
for i in range(d.bit_length()):
if (d >> i) & 1:
for i in range(k.bit_length()):
if (k >> i) & 1:
a = parent[i][a]
return a

Expand Down

0 comments on commit ec69341

Please sign in to comment.