12 2014 档案

leetcode : Longest Palindromic Substring
摘要:Given a stringS, find the longest palindromic substring inS. You may assume that the maximum length ofSis 1000, and there exists one unique longest pa... 阅读全文

posted @ 2014-12-23 21:28 远近闻名的学渣

leetcode : Trapping Rain Water
摘要:Givennnon-negative integers representing an elevation map where the width of each bar is 1, compute how much water it is able to trap after raining.Fo... 阅读全文

posted @ 2014-12-22 19:55 远近闻名的学渣 阅读(157) 评论(0) 推荐(0)

leetcode : Reverse Nodes in k-Group
摘要:Given a linked list, reverse the nodes of a linked listkat a time and return its modified list.If the number of nodes is not a multiple ofkthen left-o... 阅读全文

posted @ 2014-12-18 14:52 远近闻名的学渣 阅读(110) 评论(0) 推荐(0)

leetcode : Permutations I&II
摘要:I:Given a collection of numbers, return all possible permutations.For example,[1,2,3]have the following permutations:[1,2,3],[1,3,2],[2,1,3],[2,3,1],[... 阅读全文

posted @ 2014-12-17 19:32 远近闻名的学渣 阅读(170) 评论(0) 推荐(0)

leetcode : Merge K sorted Lists
摘要:Mergeksorted linked lists and return it as one sorted list. Analyze and describe its complexity.题目的重点在与分析描述复杂度。。。一看到多路归并就想到外部排序结果果断二了个逼。两种思路,一种是建个胜者树或... 阅读全文

posted @ 2014-12-14 22:35 远近闻名的学渣 阅读(295) 评论(0) 推荐(0)

堆排序 & 拷贝控制
摘要:class maxHeap{public: maxHeap(); maxHeap(int A[], int n); maxHeap(const maxHeap &); //拷贝控制,声明为public,允许用户进行拷贝//构造函数也能声明成private,可... 阅读全文

posted @ 2014-12-13 17:29 远近闻名的学渣 阅读(185) 评论(0) 推荐(0)

leetcode : First Missing Positive
摘要:Given an unsorted integer array, find the first missing positive integer.For example,Given[1,2,0]return3,and[3,4,-1,1]return2.Your algorithm should ru... 阅读全文

posted @ 2014-12-10 15:33 远近闻名的学渣 阅读(114) 评论(0) 推荐(0)

leetcode : Insert Interval
摘要:Given a set ofnon-overlappingintervals, insert a new interval into the intervals (merge if necessary).You may assume that the intervals were initially... 阅读全文

posted @ 2014-12-10 15:24 远近闻名的学渣 阅读(119) 评论(0) 推荐(0)

leetcode : Jump Game I&II
摘要:Given an array of non-negative integers, you are initially positioned at the first index of the array.Each element in the array represents your maximu... 阅读全文

posted @ 2014-12-09 23:06 远近闻名的学渣 阅读(147) 评论(0) 推荐(0)

leetcode : Text Justification
摘要:Given an array of words and a lengthL, format the text such that each line has exactlyLcharacters and is fully (left and right) justified.You should p... 阅读全文

posted @ 2014-12-09 22:53 远近闻名的学渣 阅读(167) 评论(0) 推荐(0)

leetcode : Search in Rotated Sorted Array I&&II
摘要:Suppose a sorted array is rotated at some pivot unknown to you beforehand.(i.e.,0 1 2 4 5 6 7might become4 5 6 7 0 1 2).You are given a target value t... 阅读全文

posted @ 2014-12-08 22:41 远近闻名的学渣 阅读(145) 评论(0) 推荐(0)

leetcode : Edit Distance
摘要:Given two wordsword1andword2, find the minimum number of steps required to convertword1toword2. (each operation is counted as 1 step.)You have the fol... 阅读全文

posted @ 2014-12-08 21:16 远近闻名的学渣 阅读(179) 评论(0) 推荐(0)

leetcode : Maximal Rectangle & Maximum Subarray & Largest Rectangle in Histogram
摘要:1,Maximum Subarray大致就是给一个int型数组,求一个长度最小为1的子数组,使得里面的数加起来和最大。很经典的dp题,方法是对于每一个i,求出以i结尾的最大子数组。而求以i 为结尾的最大子数组的问题可以变成,求以i - 1为结尾的最大子数组的值max_(i - 1),然后比较i 与m... 阅读全文

posted @ 2014-12-07 22:51 远近闻名的学渣 阅读(140) 评论(0) 推荐(0)

leetcode : 3sum
摘要:Given an arraySofnintegers, are there elementsa,b,cinSsuch thata+b+c= 0? Find all unique triplets in the array which gives the sum of zero.Note:Elemen... 阅读全文

posted @ 2014-12-06 23:08 远近闻名的学渣 阅读(185) 评论(1) 推荐(0)

leetcode : Rotate Image
摘要:You are given annxn2D matrix representing an image.Rotate the image by 90 degrees (clockwise).Follow up:Could you do this in-place?要在(1)的空间复杂度完成,所以一次转... 阅读全文

posted @ 2014-12-06 17:37 远近闻名的学渣 阅读(124) 评论(0) 推荐(0)

leetcode : Merge Intervals
摘要:Given a collection of intervals, merge all overlapping intervals.For example,Given[1,3],[2,6],[8,10],[15,18],return[1,6],[8,10],[15,18]./** * Definiti... 阅读全文

posted @ 2014-12-05 22:34 远近闻名的学渣 阅读(131) 评论(0) 推荐(0)

导航