随笔分类 - 数组
摘要:1.题目描述Givenasetofcandidatenumbers(C)andatargetnumber(T),findalluniquecombinationsinCwherethecandidatenumberssumstoT.ThesamerepeatednumbermaybechosenfromCunlimitednumberoftimes.Note:Allnumbers(includingtarget)willbepositiveintegers.Elementsinacombination(a1,a2,。。。,ak)mustbeinnon-descendingorder.(ie,a
阅读全文
摘要:1.题目描述 Given an array of non-negative integers, you are initially positioned at the first index of the array. Eac...
阅读全文
摘要:1.题目描述 Given an array of non-negative integers, you are initially positioned at the first index of the array. Eac...
阅读全文
摘要:1.题目描述Given two sorted integer arrays A and B, merge B into A as one sorted array.Note:You may assume that A has enough space to hold additional elements from B. The number of elements initialized in A and B are m and n respectively.2.解法分析这道题是归并排序的变种,我们知道,归并那一步应该是要有一个O(N+M)的辅助数组的,由于题目中说可以假设A有足够的空间来容
阅读全文
摘要:1.题目描述 Given an unsorted integer array, find the first missing positive integer. For example, Given ...
阅读全文
摘要:1.题目描述 Given an array and a value, remove all instances of that value in place and return the new length. The ord...
阅读全文
摘要:1.题目描述 Given a sorted array, remove the duplicates in place such that each element appear only once and return the new length. ...
阅读全文
摘要:1.题目描述 Given an array S of n integers, are there elements a, b, c in S such that a + b + c = 0? Find all unique triplets in the array which g...
阅读全文
摘要:1.题目描述 Given an array S of n integers, find three integers in S such that the sum is closest to a given number, target. Return the sum of the...
阅读全文
摘要:1.题目描述 There are two sorted arrays A and B of size m and n respectively. Find the median of the two sorted arrays. The overall run time complexity sh...
阅读全文
摘要:1.题目描述 Given an array of integers, find two numbers such that they add up to a specific target number. The functi...
阅读全文

浙公网安备 33010602011771号