The shortest and also the fastest solution ever!!!


  • -1
    V
    class Codec:
        def serialize(self, root):
            return root
    
        def deserialize(self, data):
            return data
    

    The Codec object will be instantiated and called as such:

    codec = Codec()
    codec.deserialize(codec.serialize(root))
    

    Imgur

    I’m cheating. LOL😀


Log in to reply
 

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