标签:span bsp leetcode func tool col sel val bin
import functools @functools.lru_cache() class Solution(object): def insertIntoBST(self, root, val): """ :type root: TreeNode :type val: int :rtype: TreeNode """ if not root: return if val > root.val: if not root.right: root.right = TreeNode(val) else: self.insertIntoBST(root.right, val) else: if not root.left: root.left = TreeNode(val) else: self.insertIntoBST(root.left, val) return root
Leetcode 701. Insert into a Binary Search Tree
标签:span bsp leetcode func tool col sel val bin
原文地址:https://www.cnblogs.com/zywscq/p/10652724.html