摘要: Lowest Common Ancestor of a Binary Search TreeGiven a binary search tree (BST), find the lowest common ancestor (LCA) of two given nodes in the BST.Ac... 阅读全文
posted @ 2015-08-29 17:14 Sean_le 阅读(144) 评论(0) 推荐(0)
摘要: Invert Binary TreeInvert a binary tree. 4 / \ 2 7 / \ / \1 3 6 9to 4 / \ 7 2 / \ / \9 6 3 1我觉得返回void更好一些,就地翻转。还是... 阅读全文
posted @ 2015-08-29 16:19 Sean_le 阅读(123) 评论(0) 推荐(0)
摘要: Same TreeGiven two binary trees, write a function to check if they are equal or not.Two binary trees are considered equal if they are structurally ide... 阅读全文
posted @ 2015-08-29 15:49 Sean_le 阅读(235) 评论(0) 推荐(0)
摘要: Maximum Depth of Binary TreeGiven a binary tree, find its maximum depth.The maximum depth is the number of nodes along the longest path from the root ... 阅读全文
posted @ 2015-08-29 15:24 Sean_le 阅读(90) 评论(0) 推荐(0)