上一页 1 ··· 6 7 8 9 10 11 12 13 14 ··· 20 下一页

[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 小刀初试 阅读(127) 评论(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 小刀初试 阅读(135) 评论(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 小刀初试 阅读(145) 评论(0) 推荐(0)

[LeetCode] 3Sum Closest, Solution

摘要: 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 three integers.... 阅读全文
posted @ 2013-01-26 06:05 小刀初试 阅读(151) 评论(0) 推荐(0)

[LeetCode] 3 Sum, Solution

摘要: 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 gives the sum of ... 阅读全文
posted @ 2013-01-26 05:48 小刀初试 阅读(167) 评论(0) 推荐(0)

[LeetCode] Binary Tree Maximum Path Sum Solution

摘要: Given a binary tree, find the maximum path sum.The path may start and end at any node in the tree.For example:Given the below binary tree, 1 ... 阅读全文
posted @ 2013-01-21 13:02 小刀初试 阅读(120) 评论(0) 推荐(0)

[LeetCode] Binary Tree Level Order Traversal Solution

摘要: Given a binary tree, return the level order traversal of its nodes' values. (ie, from left to right, level by level).For example:Given binary tree {3,... 阅读全文
posted @ 2013-01-18 15:30 小刀初试 阅读(137) 评论(0) 推荐(0)

[LeetCode] Binary Tree Inorder Traversal Solution

摘要: Given a binary tree, return the inorder traversal of its nodes' values.For example:Given binary tree {1,#,2,3}, 1 \ 2 / 3return [1,3,2].... 阅读全文
posted @ 2013-01-17 15:15 小刀初试 阅读(162) 评论(0) 推荐(0)
上一页 1 ··· 6 7 8 9 10 11 12 13 14 ··· 20 下一页