Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 282c194

Browse files
Update LCA
1 parent 2ce956b commit 282c194

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

‎LeastCommonAncestor.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ void LCA_preprocessing(ll n) {
7979
ll i, j;
8080

8181
for(i = 1; i <= n; i++) {
82-
for(j = 0; 1 << j <= n; j++) {
82+
for(j = 0; (1 << j) <= n; j++) {
8383
binary_ancestor[i][j] = -1;
8484
}
8585
}
@@ -88,7 +88,7 @@ void LCA_preprocessing(ll n) {
8888
binary_ancestor[i][0] = parent[i];
8989
}
9090

91-
for(j = 1; 1 << j <=n; j++) {
91+
for(j = 1; (1 << j) <=n; j++) {
9292
for(i = 1; i <= n; i++) {
9393
binary_ancestor[i][j] = binary_ancestor[binary_ancestor[i][j-1]][j-1];
9494
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /