Skip to content

Commit 02a3df5

Browse files
refactor 655
1 parent 2363457 commit 02a3df5

File tree

1 file changed

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

1 file changed

+0
-56
lines changed

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

Lines changed: 0 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -6,62 +6,6 @@
66
import java.util.LinkedList;
77
import java.util.List;
88

9-
/**
10-
* 655. Print Binary Tree
11-
*
12-
* Print a binary tree in an m*n 2D string array following these rules:
13-
* 1. The row number m should be equal to the height of the given binary tree.
14-
* 2. The column number n should always be an odd number.
15-
* 3. The root node's value (in string format) should be put in the exactly middle of the first row it can be put.
16-
* The column and the row where the root node belongs will separate the rest space into two parts (left-bottom part and right-bottom part).
17-
* You should print the left subtree in the left-bottom part and print the right subtree in the right-bottom part.
18-
* The left-bottom part and the right-bottom part should have the same size.
19-
* Even if one subtree is none while the other is not,
20-
* you don't need to print anything for the none subtree but
21-
* still need to leave the space as large as that for the other subtree.
22-
* However, if two subtrees are none, then you don't need to leave space for both of them.
23-
* 4. Each unused space should contain an empty string "".
24-
* 5. Print the subtrees following the same rules.
25-
26-
Example 1:
27-
Input:
28-
1
29-
/
30-
2
31-
Output:
32-
[["", "1", ""],
33-
["2", "", ""]]
34-
35-
Example 2:
36-
Input:
37-
1
38-
/ \
39-
2 3
40-
\
41-
4
42-
Output:
43-
[["", "", "", "1", "", "", ""],
44-
["", "2", "", "", "", "3", ""],
45-
["", "", "4", "", "", "", ""]]
46-
47-
Example 3:
48-
Input:
49-
1
50-
/ \
51-
2 5
52-
/
53-
3
54-
/
55-
4
56-
Output:
57-
58-
[["", "", "", "", "", "", "", "1", "", "", "", "", "", "", ""]
59-
["", "", "", "2", "", "", "", "", "", "", "", "5", "", "", ""]
60-
["", "3", "", "", "", "", "", "", "", "", "", "", "", "", ""]
61-
["4", "", "", "", "", "", "", "", "", "", "", "", "", "", ""]]
62-
63-
Note: The height of binary tree is in the range of [1, 10]
64-
*/
659
public class _655 {
6610

6711
public static class Solution1 {

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy