随笔分类 -  数组

摘要:1.题目描述Givenasetofcandidatenumbers(C)andatargetnumber(T),findalluniquecombinationsinCwherethecandidatenumberssumstoT.ThesamerepeatednumbermaybechosenfromCunlimitednumberoftimes.Note:Allnumbers(includingtarget)willbepositiveintegers.Elementsinacombination(a1,a2,。。。,ak)mustbeinnon-descendingorder.(ie,a 阅读全文
posted @ 2013-08-28 19:53 曾见绝美的阳光 阅读(382) 评论(0) 推荐(0)
摘要:1.题目描述 Given an array of non-negative integers, you are initially positioned at the first index of the array. Eac... 阅读全文
posted @ 2013-08-27 22:21 曾见绝美的阳光 阅读(477) 评论(0) 推荐(0)
摘要:1.题目描述 Given an array of non-negative integers, you are initially positioned at the first index of the array. Eac... 阅读全文
posted @ 2013-08-27 21:26 曾见绝美的阳光 阅读(249) 评论(0) 推荐(0)
摘要: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有足够的空间来容 阅读全文
posted @ 2013-08-25 13:02 曾见绝美的阳光 阅读(270) 评论(0) 推荐(0)
摘要:1.题目描述 Given an unsorted integer array, find the first missing positive integer. For example, Given ... 阅读全文
posted @ 2013-08-25 00:26 曾见绝美的阳光 阅读(249) 评论(0) 推荐(0)
摘要:1.题目描述 Given an array and a value, remove all instances of that value in place and return the new length. The ord... 阅读全文
posted @ 2013-08-23 00:14 曾见绝美的阳光 阅读(208) 评论(0) 推荐(0)
摘要:1.题目描述 Given a sorted array, remove the duplicates in place such that each element appear only once and return the new length. ... 阅读全文
posted @ 2013-08-23 00:01 曾见绝美的阳光 阅读(171) 评论(0) 推荐(0)
摘要: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... 阅读全文
posted @ 2013-08-22 22:04 曾见绝美的阳光 阅读(260) 评论(0) 推荐(0)
摘要: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... 阅读全文
posted @ 2013-08-22 18:17 曾见绝美的阳光 阅读(658) 评论(0) 推荐(0)
摘要: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... 阅读全文
posted @ 2013-08-19 00:10 曾见绝美的阳光 阅读(286) 评论(0) 推荐(0)
摘要:1.题目描述 Given an array of integers, find two numbers such that they add up to a specific target number. The functi... 阅读全文
posted @ 2013-08-18 22:08 曾见绝美的阳光 阅读(197) 评论(0) 推荐(0)