赵乐ACM

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

2013年8月7日

摘要: Given an unsorted integer array, find the first missing positive integer.For example,Given[1,2,0]return3,and[3,4,-1,1]return2.Your algorithm should run inO(n) time and uses constant space.找到第一个没有出现的正整数思路:http://tech-wonderland.net/blog/leetcode-first-missing-positive.html就是把出现的正整数a都放在a-1的位置,然后从头开始历遍 阅读全文
posted @ 2013-08-07 16:59 赵乐ACM 阅读(1340) 评论(0) 推荐(0) 编辑

摘要: Given a collection of candidate numbers (C) and a target number (T), find all unique combinations inCwhere the candidate numbers sums toT.Each number inCmay only be usedoncein the combination.Note:All numbers (including target) will be positive integers.Elements in a combination (a1,a2, � ,ak) must 阅读全文
posted @ 2013-08-07 15:50 赵乐ACM 阅读(656) 评论(0) 推荐(0) 编辑