@@ -0,0 +1,1286 @@
+/**%0A * Definition for a binary tree node.%0A * public class TreeNode %7B%0A *     int val;%0A *     TreeNode left;%0A *     TreeNode right;%0A *     TreeNode(int x) %7B val = x; %7D%0A * %7D%0A */%0Apublic class Codec %7B%0A%0A    // Encodes a tree to a single string.%0A    public String serialize(TreeNode head) %7B%0A        if(head == null)%7B%0A            return %22#! %22;%0A        %7D%0A        String res = head.val+%22! %22;%0A        res += serialize(head.left);%0A        res += serialize(head.right);%0A        return res;%0A        %0A    %7D%0A%0A    // Decodes your encoded data to tree.%0A    public TreeNode deserialize(String data) %7B%0A        String%5B%5D value = data.split(%22! %22);%0A        Queue%3CString%3E queue = new LinkedList%3C%3E();%0A        for(int i=0;i%3Cvalue.length;i++)%7B%0A            queue.offer(value%5Bi%5D);%0A        %7D%0A        return reconPreOrder(queue);%0A        %0A    %7D%0A    private TreeNode reconPreOrder(Queue%3CString%3E queue)%7B%0A        String value = queue.poll();%0A        if(value.equals(%22#%22))%7B%0A            return null;%0A        %7D%0A        TreeNode head = new TreeNode(Integer.valueOf(value));%0A        head.left = reconPreOrder(queue);%0A        head.right = reconPreOrder(queue);%0A        return head;%0A    %7D%0A%7D%0A%0A// Your Codec object will be instantiated and called as such:%0A// Codec codec = new Codec();%0A// codec.deserialize(codec.serialize(root));

The solution for 297