Skip to content

Commit 9a9db67

Browse files
fix build
1 parent e719179 commit 9a9db67

File tree

1 file changed

+6
-3
lines changed
  • src/main/java/com/fishercoder/solutions

1 file changed

+6
-3
lines changed

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

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@ public TreeNode deserialize(String data) {
151151
return root;
152152
}
153153
}
154+
154155
public static class Solution4 {
155156
private static final String NULL_SYMBOL = "X";
156157
private static final String DELIMITER = ",";
@@ -159,8 +160,9 @@ public static class Solution4 {
159160
public String serialize(TreeNode root) {
160161

161162
// If we have a null symbol, encode it to NULL_SYMBOL
162-
if(root == null)
163+
if (root == null) {
163164
return NULL_SYMBOL + DELIMITER;
165+
}
164166

165167
String leftSubtree = serialize(root.left);
166168
String rightSubtree = serialize(root.right);
@@ -176,12 +178,13 @@ public TreeNode deserialize(String data) {
176178
return deserializeHelper(nodesLeftToSerialize);
177179

178180
}
179-
private TreeNode deserializeHelper(Queue<String> nodesLeft){
181+
182+
private TreeNode deserializeHelper(Queue<String> nodesLeft) {
180183

181184
// remove the node
182185
String nodeLeftToSerialize = nodesLeft.poll();
183186
// base case
184-
if(nodeLeftToSerialize.equals(NULL_SYMBOL)){
187+
if (nodeLeftToSerialize.equals(NULL_SYMBOL)) {
185188
return null;
186189
}
187190
TreeNode newNode = new TreeNode(Integer.valueOf(nodeLeftToSerialize));

0 commit comments

Comments
 (0)