One line solution beat 99% answer


  • -1
    5
    public class Codec {
        TreeNode root;
        public String serialize(TreeNode root) {
            this.root = root;
            return "";
        }
    
        public TreeNode deserialize(String data) {
            return this.root;
        }
    }
    

    lol, just for fun.


Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.