摘要: Given a binary tree, return thelevel ordertraversal of its nodes' values. (ie, from left to right, level by level).For example:Given binary tree{3,9,2... 阅读全文
posted @ 2015-10-06 12:27 茜茜的技术空间 阅读(123) 评论(0) 推荐(0)
摘要: Given a binary tree, return thebottom-up level ordertraversal of its nodes' values. (ie, from left to right, level by level from leaf to root).For exa... 阅读全文
posted @ 2015-10-06 11:21 茜茜的技术空间 阅读(131) 评论(0) 推荐(0)
摘要: You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed, the only constraint stopping yo... 阅读全文
posted @ 2015-10-06 08:54 茜茜的技术空间 阅读(348) 评论(0) 推荐(0)
摘要: Given apatternand a stringstr, find ifstrfollows the same pattern.Examples:pattern ="abba", str ="dog cat cat dog"should return true.pattern ="abba", ... 阅读全文
posted @ 2015-10-06 08:28 茜茜的技术空间 阅读(442) 评论(0) 推荐(0)
摘要: A strobogrammatic number is a number that looks the same when rotated 180 degrees (looked at upside down).Write a function to determine if a number is... 阅读全文
posted @ 2015-10-06 07:44 茜茜的技术空间 阅读(236) 评论(0) 推荐(0)
摘要: Given an array of meeting time intervals consisting of start and end times[[s1,e1],[s2,e2],...](si= Ei, if true, continue compare, if false, return fa... 阅读全文
posted @ 2015-10-06 03:40 茜茜的技术空间 阅读(234) 评论(0) 推荐(0)
摘要: Given an indexk, return thekthrow of the Pascal's triangle.For example, givenk= 3,Return[1,3,3,1].Note:Could you optimize your algorithm to use onlyO(... 阅读全文
posted @ 2015-10-06 03:10 茜茜的技术空间 阅读(171) 评论(0) 推荐(0)
摘要: GivennumRows, generate the firstnumRowsof Pascal's triangle.For example, givennumRows= 5,Return[ [1], [1,1], [1,2,1], [1,3,3,1], [1,4,6,4,1]... 阅读全文
posted @ 2015-10-06 02:47 茜茜的技术空间 阅读(170) 评论(0) 推荐(0)
摘要: Given an integer array of sizen, find all elements that appear more than⌊ n/3 ⌋times. The algorithm should run in linear time and in O(1) space.Hint:H... 阅读全文
posted @ 2015-10-06 02:22 茜茜的技术空间 阅读(336) 评论(0) 推荐(0)
摘要: Given an array of sizen, find the majority element. The majority element is the element that appears more than⌊ n/2 ⌋times.You may assume that the arr... 阅读全文
posted @ 2015-10-06 01:42 茜茜的技术空间 阅读(286) 评论(0) 推荐(0)