摘要: No.217 Contains DuplicateGiven an array of integers, find if the array contains any duplicates. Your function should return true if any value appears ... 阅读全文
posted @ 2015-06-10 15:29 人生不酱油 阅读(115) 评论(0) 推荐(0) 编辑
摘要: No.14 Longest Common PrefixWrite a function to find the longest common prefix string amongst an array of strings.求一组string的最长公共前缀想法:找到最短的那个,然后依次对比典型的字... 阅读全文
posted @ 2015-06-10 15:09 人生不酱油 阅读(125) 评论(0) 推荐(0) 编辑
摘要: No.118 Pascal's Triangle ||Given an indexk, return thekthrow of the Pascal's triangle.For example, givenk= 3,Return[1,3,3,1].思路: 生成帕斯卡三角形第rowIndex+1行... 阅读全文
posted @ 2015-06-09 22:16 人生不酱油 阅读(126) 评论(0) 推荐(0) 编辑
摘要: No.118 Pascal's TriangleGivennumRows, generate the firstnumRowsof Pascal's triangle.For example, givennumRows= 5,Return[ [1], [1,1], [1,2,1],... 阅读全文
posted @ 2015-06-09 22:06 人生不酱油 阅读(98) 评论(0) 推荐(0) 编辑
摘要: No.179 Largest NumberGiven a list of non negative integers, arrange them such that they form the largest number.For example, given[3, 30, 34, 5, 9], t... 阅读全文
posted @ 2015-06-09 21:34 人生不酱油 阅读(289) 评论(0) 推荐(0) 编辑
摘要: No.56 Merge IntervalsGiven a collection of intervals, merge all overlapping intervals.For example,Given[1,3],[2,6],[8,10],[15,18],return[1,6],[8,10],[... 阅读全文
posted @ 2015-06-09 11:16 人生不酱油 阅读(172) 评论(0) 推荐(0) 编辑
摘要: No.57 Insert IntervalGiven a set ofnon-overlappingintervals, insert a new interval into the intervals (merge if necessary).You may assume that the int... 阅读全文
posted @ 2015-06-09 10:37 人生不酱油 阅读(384) 评论(0) 推荐(0) 编辑
摘要: No.164 Maximum GapGiven an unsorted array, find the maximum difference between the successive elements in its sorted form.Try to solve it in linear ti... 阅读全文
posted @ 2015-06-08 17:10 人生不酱油 阅读(98) 评论(0) 推荐(0) 编辑
摘要: No.75 Sort ColorsGiven an array withnobjects colored red, white or blue, sort them so that objects of the same color are adjacent, with the colors in ... 阅读全文
posted @ 2015-06-08 16:32 人生不酱油 阅读(101) 评论(0) 推荐(0) 编辑
摘要: No.28 Implement strStr()Implement strStr().Returns the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack.分析... 阅读全文
posted @ 2015-06-02 21:52 人生不酱油 阅读(131) 评论(0) 推荐(0) 编辑