Skip to content

Commit 9b9cf00

Browse files
refactor 606
1 parent b730089 commit 9b9cf00

File tree

1 file changed

+0
-35
lines changed
  • src/main/java/com/fishercoder/solutions

1 file changed

+0
-35
lines changed

src/main/java/com/fishercoder/solutions/_606.java

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -2,41 +2,6 @@
22

33
import com.fishercoder.common.classes.TreeNode;
44

5-
/**
6-
* 606. Construct String from Binary Tree
7-
*
8-
* You need to construct a string consists of parenthesis and integers from a binary tree with the preorder traversing way.
9-
The null node needs to be represented by empty parenthesis pair "()".
10-
And you need to omit all the empty parenthesis pairs that don't affect the one-to-one mapping relationship between the string
11-
and the original binary tree.
12-
13-
Example 1:
14-
Input: Binary tree: [1,2,3,4]
15-
1
16-
/ \
17-
2 3
18-
/
19-
4
20-
21-
Output: "1(2(4))(3)"
22-
23-
Explanation: Originallay it needs to be "1(2(4)())(3()())",
24-
but you need to omit all the unnecessary empty parenthesis pairs.
25-
And it will be "1(2(4))(3)".
26-
27-
Example 2:
28-
Input: Binary tree: [1,2,3,null,4]
29-
1
30-
/ \
31-
2 3
32-
\
33-
4
34-
35-
Output: "1(2()(4))(3)"
36-
37-
Explanation: Almost the same as the first example,
38-
except we can't omit the first parenthesis pair to break the one-to-one mapping relationship between the input and the output.
39-
*/
405
public class _606 {
416

427
public static class Solution1 {

0 commit comments

Comments
 (0)