Python simple solution

  • 0
    class Solution(object):
        def deserialize_core(self, data_list):
            if isinstance(data_list, list):
                nested_integer = NestedInteger()
                for n in data_list:
                return nested_integer
                return NestedInteger(data_list)
        def deserialize(self, s):
            data = eval(s)
            return self.deserialize_core(data)

Log in to reply

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