Skip to content

Commit 716508a

Browse files
authored
Merge pull request #1465 from maradadivyasree020/lc-606-photo
Lc 606 photo
2 parents 3e15b8d + 98b84de commit 716508a

File tree

4 files changed

+6
-2
lines changed

4 files changed

+6
-2
lines changed

assets/606 ex1.png

33 KB
Loading

assets/606 ex2.png

30.1 KB
Loading

dsa-solutions/lc-solutions/0600-0699/0606-Construct-String-from-Binary-Tree.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,18 @@ description: "Given the root of a binary tree, construct a string consisting of
1414
Given the root of a binary tree, construct a string consisting of parenthesis and integers from a binary tree with the preorder traversal way.
1515

1616
### Examples
17-
1817
**Example 1:**
1918

19+
![Screenshot of the application](.././../../assets/606%20ex1.png)
20+
2021
**Input:** `root = [1,2,3,4]`
2122
**Output:** `"1(2(4))(3)"`
2223
**Explanation:** Originally, it needs to be `"1(2(4)())(3()())"`, but you need to omit all the unnecessary empty parenthesis pairs. And it will be `"1(2(4))(3)"`
2324

2425
**Example 2:**
2526

27+
![Screenshot of the application](.././../../assets/606%20ex2.png)
28+
2629
**Input:** `root = [1,2,3,null,4]`
2730
**Output:** `"1(2()(4))(3)"`
2831
**Explanation:** Originally, it needs to be `"1(2()(4)())(3()())"`, but you need to omit all the unnecessary empty parenthesis pairs. And it will be `"1(2()(4))(3)"`
@@ -127,4 +130,4 @@ class Solution:
127130
>Reason: The space complexity is determined by the recursion stack, which in the worst case (unbalanced tree) is O(n), but on average (balanced tree) is O(log n).
128131
129132
### References
130-
**LeetCode Problem:** Construct String from Binary Tree
133+
**LeetCode Problem:** Construct String from Binary Tree
Lines changed: 1 addition & 0 deletions
Loading

0 commit comments

Comments
 (0)