Skip to content

Commit 4487405

Browse files
authored
Update 2096.Step-By-Step-Directions-From-a-Binary-Tree-Node-to-Another.cpp
1 parent 06de308 commit 4487405

File tree

1 file changed

+0
-3
lines changed

1 file changed

+0
-3
lines changed

Tree/2096.Step-By-Step-Directions-From-a-Binary-Tree-Node-to-Another/2096.Step-By-Step-Directions-From-a-Binary-Tree-Node-to-Another.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,13 @@ class Solution {
1414
string getDirections(TreeNode* root, int startValue, int destValue)
1515
{
1616
vector<int>nums1, nums2;
17-
nums1.push_back(root->val);
18-
nums2.push_back(root->val);
1917
string dirs1, dirs2;
2018
dfs(root, nums1, dirs1, startValue);
2119
dfs(root, nums2, dirs2, destValue);
2220

2321
int k = 0;
2422
while (k<nums1.size() && k<nums2.size() && nums1[k]==nums2[k])
2523
k++;
26-
k--;
2724
for (int i=k; i<dirs1.size(); i++) dirs1[i] = 'U';
2825
return dirs1.substr(k)+dirs2.substr(k);
2926

0 commit comments

Comments
 (0)