labuladong / basic-challenge

200 stars 22 forks source link

已结束 #356

Closed labuladong closed 1 year ago

labuladong commented 1 year ago

本期打卡已结算完成。报名最新一期的打卡活动 点这里

CarolSSS commented 1 year ago

https://leetcode.com/problems/flatten-binary-tree-to-linked-list/solutions/3916510/recursion/

DannyT70 commented 1 year ago

https://leetcode.cn/problems/flatten-binary-tree-to-linked-list/solution/er-cha-shu-2-by-sleepy-shawffi-5foy/

DannyT70 commented 1 year ago

https://leetcode.cn/problems/flatten-binary-tree-to-linked-list/solution/er-cha-shu-2-by-sleepy-shawffi-5foy/

KarlZhu-SE commented 1 year ago

https://leetcode.com/problems/flatten-binary-tree-to-linked-list/solutions/3916905/flatten/

alyssasuper3 commented 1 year ago

https://leetcode.cn/problems/invert-binary-tree/solutions/2391260/fan-zhuan-er-cha-shu-by-alyssasuper3-o660/

imzhuting commented 1 year ago

https://leetcode.cn/problems/invert-binary-tree/solutions/2391273/fan-zhuan-er-cha-shu-by-emilia-8-191x/

Sadwy commented 1 year ago

LC114. https://leetcode.com/problems/flatten-binary-tree-to-linked-list/solutions/3917102/topic/

AstrKing commented 1 year ago

226:https://leetcode.cn/problems/invert-binary-tree/solutions/2070398/fan-zhuan-er-cha-shu-by-aktrking-y50b/

cs-gavin-huang commented 1 year ago

https://leetcode.com/problems/populating-next-right-pointers-in-each-node/solutions/3918191/populating-next-right-pointers-in-each-node/

tonyzhu163 commented 1 year ago
# Aug 16 

# LC Invert Tree
# recusive solution is straightforward
# traverse solution do inversion and then traverse

class Solution:
    def invertTree(self, root: Optional[TreeNode]) -> Optional[TreeNode]:
        if not root:
            return

        left = self.invertTree(root.left)
        right = self.invertTree(root.right)

        root.left = right
        root.right = left

        return root
ElaineZhou-moon commented 1 year ago

https://leetcode.com/problems/invert-binary-tree/solutions/3918628/invert-binary-tree/

YilinYan0 commented 1 year ago

https://leetcode.com/problems/invert-binary-tree/post-solution/?submissionId=1023146475