题目
Given an array of integers, find two numbers such that they add up to a specific target number.
The function twoSum should return indices of the two numbers such that they add up to the...
分类:
其他好文 时间:
2014-06-18 12:05:44
阅读次数:
244
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],
[2,3],
[1,2],
[1,3],
[1,4],
]...
分类:
其他好文 时间:
2014-06-18 11:41:52
阅读次数:
156
题目
Determine whether an integer is a palindrome. Do this without extra space.
Some hints:
Could negative integers be palindromes? (ie, -1)
If you are thinking of converting the integer to ...
分类:
其他好文 时间:
2014-06-17 16:12:39
阅读次数:
226
题目
Implement next permutation, which rearranges numbers into the lexicographically next greater permutation of numbers.
If such arrangement is not possible, it must rearrange it as the low...
分类:
其他好文 时间:
2014-06-16 18:48:33
阅读次数:
170
Implement next permutation, which rearranges numbers into the lexicographically next greater permutation of numbers.If such arrangement is not possibl...
分类:
其他好文 时间:
2014-06-15 21:21:17
阅读次数:
152
题目
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],
[2,3],
[1,2],
[1,3],...
分类:
其他好文 时间:
2014-06-15 14:10:54
阅读次数:
239
原题地址:https://oj.leetcode.com/problems/add-two-numbers/题意:You are given two linked lists representing two non-negative numbers. The digits are stored i...
分类:
编程语言 时间:
2014-06-15 00:40:44
阅读次数:
328
Decription:Given a triangle, find the minimum path sum from top to bottom. Each step you may move to adjacent numbers on the row below.For example, gi...
分类:
其他好文 时间:
2014-06-14 19:46:12
阅读次数:
251
Determine whether an integer is a palindrome. Do this without extra space.click to show spoilers.Some hints:Could negative integers be palindromes? (i...
分类:
其他好文 时间:
2014-06-14 08:52:31
阅读次数:
265
题目
A message containing letters from A-Z is being encoded to numbers using the following mapping:
原题链接(点我)
解题思路及代码;
解码方法数量问题。英文26个字母对应1到26,给一串数字,问翻译为字母有多少种方法?
这个题第一思路是想到使用组合排列的方法,穷举所有的可能。很好,写出如下代码...
但是提交后出来的结果是超时。
再想想,使用动态规划的方法来做。
对于串s[0...i]的解码数量应该和s[0.....
分类:
其他好文 时间:
2014-06-13 20:44:04
阅读次数:
292