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 e245fa3 commit 1e9ed3fCopy full SHA for 1e9ed3f
solution/1400-1499/1483.Kth Ancestor of a Tree Node/Solution.ts
@@ -6,8 +6,8 @@ class TreeAncestor {
6
for (let i = 0; i < n; ++i) {
7
p[i][0] = parent[i];
8
}
9
- for (let i = 0; i < n; ++i) {
10
- for (let j = 1; j < 18; ++j) {
+ for (let j = 1; j < 18; ++j) {
+ for (let i = 0; i < n; ++i) {
11
if (p[i][j - 1] === -1) {
12
continue;
13
0 commit comments