[LeetCode] Combinations, Solution

摘要: Given two integers n and k, return all possible combinations of k numbers out of 1 ... n.For example,If n = 4 and k = 2, a solution is:[ [2,4], [3,4... 阅读全文
posted @ 2013-01-27 10:37 小刀初试 阅读(124) 评论(0) 推荐(0)

[LeetCode] Combination Sum II, Solution

摘要: Given 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 numb... 阅读全文
posted @ 2013-01-27 08:13 小刀初试 阅读(137) 评论(0) 推荐(0)

[LeetCode] Combination Sum, Solution

摘要: Given 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 repeate... 阅读全文
posted @ 2013-01-27 08:06 小刀初试 阅读(134) 评论(0) 推荐(0)

[LeetCode] Climbing Stairs, Solution

摘要: You 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 cli... 阅读全文
posted @ 2013-01-27 07:14 小刀初试 阅读(112) 评论(0) 推荐(0)

[LeetCode] Add Two Numbers, Solution

摘要: You 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 ... 阅读全文
posted @ 2013-01-27 05:46 小刀初试 阅读(143) 评论(0) 推荐(0)