
算法分析与实现
文章平均质量分 84
hooha
这个作者很懒,什么都没留下…
展开
-
3Sum Closest
3Sum ClosestGiven 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 three integers. You may assume that each in原创 2012-08-13 14:07:06 · 3387 阅读 · 0 评论 -
Combination Sum
Combination SumGiven a set of candidate numbers (C) and a target number (T), find all unique combinations in C where the candidate numbers sums to T.The same repeated number may be c原创 2012-08-23 01:45:34 · 8875 阅读 · 3 评论 -
Permutations
PermutationsGiven 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], [3,1,2], and [3,2,原创 2012-08-23 00:36:52 · 848 阅读 · 0 评论 -
Anagrams
AnagramsGiven an array of strings, return all groups of strings that are anagrams.Note: All inputs will be in lower-case.什么是anagrams?/** 整理的提交代码 * 处理复杂度为O(n),n是字符串个数,但是其中有排序等步骤没有固原创 2012-08-14 19:24:10 · 936 阅读 · 0 评论 -
Climbing Stairs
Climbing StairsYou are climbing a stair case. It takes n steps to reach to the top.Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb to the top?/** 整理的原创 2012-08-14 20:50:19 · 676 阅读 · 0 评论 -
Add Two Numbers
Add Two NumbersYou are given two linked lists representing two non-negative numbers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers原创 2012-08-14 15:33:33 · 742 阅读 · 0 评论 -
4Sum
4SumGiven an array S of n integers, are there elements a, b, c, and d in S such that a + b + c + d = target? Find all unique quadruplets in the array which gives the sum of target.No原创 2012-08-13 19:14:22 · 1715 阅读 · 0 评论 -
Add Binary
Add BinaryGiven two binary strings, return their sum (also a binary string).For example,a = "11"b = "1"Return "100"./** 整理的提交代码 * 处理复杂度为O(max(n1,n2)) * 主要思路: * 1、先处理特殊情况,有其中一个为空,则原创 2012-08-13 23:33:01 · 2210 阅读 · 0 评论 -
3Sum
3SumGiven 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 gives the sum of zero.Note:Elements in原创 2012-08-12 17:16:56 · 6613 阅读 · 0 评论 -
Combination Sum II
Combination Sum IIGiven a collection of candidate numbers (C) and a target number (T), find all unique combinations in C where the candidate numbers sums to T.Each number in C may on原创 2012-08-23 02:55:49 · 2466 阅读 · 0 评论