摘要: Minimum Depth of Binary TreeGiven a binary tree, find its minimum depth.The minimum depth is the number of nodes along the shortest path from the root... 阅读全文
posted @ 2014-10-22 15:16 zlz~ling 阅读(138) 评论(0) 推荐(0) 编辑
摘要: Balanced Binary TreeGiven a binary tree, determine if it is height-balanced.For this problem, a height-balanced binary tree is defined as a binary tre... 阅读全文
posted @ 2014-10-22 11:13 zlz~ling 阅读(131) 评论(0) 推荐(0) 编辑
摘要: Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the values along the path equals the given sum.Fo... 阅读全文
posted @ 2014-10-20 10:53 zlz~ling 阅读(111) 评论(0) 推荐(0) 编辑
摘要: Linked List Cycle IIGiven a linked list, return the node where the cycle begins. If there is no cycle, returnnull.比I麻烦点的就是找到循环开始点TATI只是判断是否循环。要求不使用额外空... 阅读全文
posted @ 2014-10-20 10:16 zlz~ling 阅读(128) 评论(0) 推荐(0) 编辑
摘要: Linked List CycleGiven a linked list, determine if it has a cycle in it.c++/** * Definition for singly-linked list. * struct ListNode { * int val;... 阅读全文
posted @ 2014-10-19 22:04 zlz~ling 阅读(148) 评论(0) 推荐(0) 编辑
摘要: Single NumberGiven an array of integers, every element appearstwiceexcept for one. Find that single one.c++版:class Solution {public: int singleNumbe... 阅读全文
posted @ 2014-10-19 21:20 zlz~ling 阅读(121) 评论(0) 推荐(0) 编辑
摘要: Binary Tree Preorder TraversalGiven a binary tree, return thepreordertraversal of its nodes' values.For example:Given binary tree{1,#,2,3}, 1 \ ... 阅读全文
posted @ 2014-10-19 21:16 zlz~ling 阅读(166) 评论(0) 推荐(0) 编辑
摘要: Max Points on a LineGivennpoints on a 2D plane, find the maximum number of points that lie on the same straight line.c++版本:/** * Definition for a poi... 阅读全文
posted @ 2014-10-19 21:12 zlz~ling 阅读(159) 评论(0) 推荐(0) 编辑
摘要: Evaluate Reverse Polish NotationValid operators are+,-,*,/. Each operand may be an integer or another expression.Some examples: ["2", "1", "+", "3", ... 阅读全文
posted @ 2014-10-19 21:10 zlz~ling 阅读(124) 评论(0) 推荐(0) 编辑
摘要: Reverse Words in a StringGiven an input string, reverse the string word by word.For example,Given s = "the sky is blue",return "blue is sky the".c++版:... 阅读全文
posted @ 2014-10-19 21:00 zlz~ling 阅读(127) 评论(0) 推荐(0) 编辑