11 2024 档案
摘要:230.二叉搜索树中第k小的元素 /** * Definition for a binary tree node. * function TreeNode(val, left, right) { * this.val = (val undefined ? 0 : val) * this.left =
阅读全文
摘要:class TreeNode { constructor(val, left = null, right = null) { this.val = val; this.left = left; this.right = right; } } var isValidBST = function (ro
阅读全文
摘要:var maxDepth = function(root) { if(root null)return 0 let leftMax=1 let rightMax=1 if(root.left)leftMax=maxDepth(root.left)+1 if(root.right)rightMax=m
阅读全文