摘要:
二叉搜索树中第K小的元素 【迭代】 k总是有效的,当k 元素个数时,再最后一次res.push(root.val);后,就不再进入while循环了,因此有两个出口。 /** * Definition for a binary tree node. * function TreeNode(val, l 阅读全文
posted @ 2021-01-25 23:09
团叽
阅读(125)
评论(0)
推荐(0)
摘要:
Maximum Depth of Binary Tree (Easy) 【递归】 var maxDepth = function(root) { if(root null) return 0; const max = (a, b) => { return a > b ? a : b; } retur 阅读全文
posted @ 2021-01-25 21:02
团叽
阅读(108)
评论(0)
推荐(0)

浙公网安备 33010602011771号