slow but pythonic: yield iterator and functional

  • 0
    class Solution(object):
        def it(self, root):
            if not root:
                raise StopIteration
            for val in
                yield val
            yield root.val
            for val in
                yield val
        def getMinimumDifference(self, root):
            lst = list(
            return min(map(lambda p:abs(p[0] - p[1]), zip(lst, lst[1:])))

Log in to reply

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