Fork me on GitHub
摘要: 题目:Invert a binary tree. 4 / \ 2 7 / \ / \1 3 6 9to 4 / \ 7 2 / \ / \9 6 3 1Trivia:This problem was inspired byt... 阅读全文
posted @ 2015-08-18 16:35 __Neo 阅读(102) 评论(0) 推荐(0) 编辑
摘要: 题目:Given a binary search tree (BST), find the lowest common ancestor (LCA) of two given nodes in the BST.According to thedefinition of LCA on Wikipedi... 阅读全文
posted @ 2015-08-18 16:06 __Neo 阅读(220) 评论(0) 推荐(0) 编辑
摘要: 题目:Write a function that takes an unsigned integer and returns the number of ’1' bits it has (also known as theHamming weight).For example, the 32-bit... 阅读全文
posted @ 2015-08-18 11:32 __Neo 阅读(111) 评论(0) 推荐(0) 编辑
摘要: 题目:Say you have an array for which theithelement is the price of a given stock on dayi.Design an algorithm to find the maximum profit. You may complet... 阅读全文
posted @ 2015-08-18 11:10 __Neo 阅读(290) 评论(0) 推荐(0) 编辑
摘要: 题目:Given two binary trees, write a function to check if they are equal or not.Two binary trees are considered equal if they are structurally identical... 阅读全文
posted @ 2015-08-18 10:39 __Neo 阅读(108) 评论(0) 推荐(0) 编辑