摘要: Given a binary search tree (BST), find the lowest common ancestor (LCA) of two given nodes in the BST. According to the definition of LCA on Wikipedia: “The lowest common ancestor is defined between t... 阅读全文
posted @ 2015-10-15 20:15 dylqt 阅读(136) 评论(0) 推荐(0) 编辑
摘要: Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center). For example, this binary tree is symmetric: 1 / \ 2 2 / \ / \ 3 4 4 3 But the following is ... 阅读全文
posted @ 2015-10-15 16:06 dylqt 阅读(147) 评论(0) 推荐(0) 编辑
摘要: Invert a binary tree. 4 / \ 2 7 / \ / \ 1 3 6 9to 4 / \ 7 2 / \ / \ 9 6 3 1 /** * Definition for a binary tree node. * struct TreeNode { * int val; ... 阅读全文
posted @ 2015-10-15 08:51 dylqt 阅读(115) 评论(0) 推荐(0) 编辑