摘要:
Given a list of integers, which denote a permutation.Find the previous permutation in ascending order.NoteThe list may contains duplicate integers.Exa... 阅读全文
摘要:
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... 阅读全文
摘要:
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... 阅读全文
摘要:
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] 阅读全文
摘要:
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... 阅读全文