摘要: Given a list of integers, which denote a permutation.Find the previous permutation in ascending order.NoteThe list may contains duplicate integers.Exa... 阅读全文
posted @ 2014-12-29 09:55 LiBlog 阅读(290) 评论(0) 推荐(0) 编辑
摘要: Given an integer array, heapify it into a min-heap array.For a heap array A, A[0] is the root of heap, and for each A[i], A[i * 2 + 1] is the left chi... 阅读全文
posted @ 2014-12-29 09:10 LiBlog 阅读(738) 评论(0) 推荐(0) 编辑
摘要: Numbers keep coming, return the median of numbers at every time a new number added.ExampleFor numbers coming list: [1, 2, 3, 4, 5], return [1, 1, 2, 2... 阅读全文
posted @ 2014-12-29 09:02 LiBlog 阅读(451) 评论(0) 推荐(0) 编辑
摘要: Given a sequence of integers, find the longest increasing subsequence (LIS). You code should return the length of the LIS. Example For [5, 4, 1, 2, 3] 阅读全文
posted @ 2014-12-29 04:45 LiBlog 阅读(2124) 评论(0) 推荐(0) 编辑
摘要: Find K-th largest element in an array.NoteYou can swap elements in the arrayExampleIn array [9,3,2,4,8], the 3th largest element is 4ChallengeO(n) tim... 阅读全文
posted @ 2014-12-29 04:16 LiBlog 阅读(348) 评论(0) 推荐(0) 编辑