Java | faster than  99.97% | HashMap
\npublic class Codec {\n    \n        \n    private void inorder(TreeNode root, StringBuilder sb)\n    {\n        if(root==null) return;\n        \n        sb.a
```\npublic class Codec {\n    \n        \n    private void inorder(TreeNode root, StringBuilder sb)\n    {\n        if(root==null) return;\n        \n        sb.append(String.valueOf(root.val));  \n        sb.append(" ");\n        inorder(root.left,sb);\n        inorder(root.right,sb);\n    }\n\n    public String serialize(TreeNode root) {\n        if(root==null) return "";  \n        StringBuilder sb = new StringBuilder();\n        inorder(root, sb);\n        \n        return sb.toString().trim();\n    }\n\n    public TreeNode construct(TreeNode root, int val)\n    {\n        \n        if(root==null) return new TreeNode(val);\n        \n        if(root.val>val)\n            root.left = construct(root.left, val);\n        else\n            root.right = construct(root.right, val);\n\n        return root;\n        \n    }\n    public TreeNode deserialize(String data) {\n       if(data=="") return null;\n        String[] a = data.split(" ");\n        TreeNode root=null;\n        \n          for(String str : a)\n          {\n              root = construct(root, Integer.parseInt(str));\n          }\n         \n        return root;\n    }\n}\n\n\n```
[]