Python simple recursion


  • 0
    W
    def rightSideView(self, root):
        if not root: return []
        left = self.rightSideView(root.left)
        right = self.rightSideView(root.right)
        return [root.val] + right + left[len(right):]

Log in to reply
 

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