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 nu...
分类:
其他好文 时间:
2014-10-10 16:26:13
阅读次数:
141
1 from random import choice 2 3 cave_numbers = range(1,21) 4 wumpus_location = choice(cave_numbers) 5 player_location = choice(cave_numbers) 6 while.....
分类:
编程语言 时间:
2014-10-10 15:18:43
阅读次数:
289
第一种方法是DFS,将所有可能的前缀找到,递归调用partition(剩余字符串)
复杂度为O(2^n)
代码如下:
vector> partition(string s) {
vector> res;
vector patition;
if (s.size() == 0) return res;
partition(s...
分类:
其他好文 时间:
2014-10-10 01:33:23
阅读次数:
464
Problem: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...
分类:
其他好文 时间:
2014-10-10 01:32:53
阅读次数:
213
Prime NumberTimeLimit:1 SecondMemoryLimit:32 MegabyteTotalsubmit:399Accepted:88DescriptionWe know that the number of prime numbers is countless. Now w...
分类:
其他好文 时间:
2014-10-09 23:06:21
阅读次数:
176
Two Sum Problem:Given an array of integers, find two numbers such that they add up to a specific target number.The function twoSum should return indic...
分类:
其他好文 时间:
2014-10-09 23:05:37
阅读次数:
273
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 digit. Add the two numbers and return it as a link...
分类:
其他好文 时间:
2014-10-09 17:15:15
阅读次数:
218
[leetcode]Given two numbers represented as strings, return multiplication of the numbers as a string....
分类:
其他好文 时间:
2014-10-09 16:02:38
阅读次数:
174
此题不难,可以用dfs来做,也可以用动态规划,但明显dfs性能不如dp。
Given a m x n grid filled with non-negative numbers, find a path from top left to bottom right which minimizes the sum of all numbers along its path.
Note:...
分类:
编程语言 时间:
2014-10-09 15:59:48
阅读次数:
163
You are given a grid of numbers. A snake sequence is made up of adjacent numbers such that for each number, the number on the right or the number belo...
分类:
其他好文 时间:
2014-10-09 14:15:14
阅读次数:
197