Skip to content

Commit 3e89b26

Browse files
committed
fix: update
1 parent 3c33eb5 commit 3e89b26

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

solution/2000-2099/2096.Step-By-Step Directions From a Binary Tree Node to Another/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -469,7 +469,8 @@ class Solution {
469469
dfs(root, startValue, pathToStart);
470470
dfs(root, destValue, pathToDest);
471471
int i = 0;
472-
while (i < pathToStart.length() && i < pathToDest.length() && pathToStart.charAt(i) == pathToDest.charAt(i)) {
472+
while (i < pathToStart.length() && i < pathToDest.length()
473+
&& pathToStart.charAt(i) == pathToDest.charAt(i)) {
473474
++i;
474475
}
475476
return "U".repeat(pathToStart.length() - i) + pathToDest.substring(i);

solution/2000-2099/2096.Step-By-Step Directions From a Binary Tree Node to Another/README_EN.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -465,7 +465,8 @@ class Solution {
465465
dfs(root, startValue, pathToStart);
466466
dfs(root, destValue, pathToDest);
467467
int i = 0;
468-
while (i < pathToStart.length() && i < pathToDest.length() && pathToStart.charAt(i) == pathToDest.charAt(i)) {
468+
while (i < pathToStart.length() && i < pathToDest.length()
469+
&& pathToStart.charAt(i) == pathToDest.charAt(i)) {
469470
++i;
470471
}
471472
return "U".repeat(pathToStart.length() - i) + pathToDest.substring(i);

solution/2000-2099/2096.Step-By-Step Directions From a Binary Tree Node to Another/Solution2.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ public String getDirections(TreeNode root, int startValue, int destValue) {
55
dfs(root, startValue, pathToStart);
66
dfs(root, destValue, pathToDest);
77
int i = 0;
8-
while (i < pathToStart.length() && i < pathToDest.length() && pathToStart.charAt(i) == pathToDest.charAt(i)) {
8+
while (i < pathToStart.length() && i < pathToDest.length()
9+
&& pathToStart.charAt(i) == pathToDest.charAt(i)) {
910
++i;
1011
}
1112
return "U".repeat(pathToStart.length() - i) + pathToDest.substring(i);

0 commit comments

Comments
 (0)