dfs会爆栈 可以 bfs或者用栈模拟函数 ...
分类:
其他好文 时间:
2017-09-18 22:13:12
阅读次数:
177
427-生成括号 题目:给定 n 对括号,请写一个函数以将其生成新的括号组合,并返回所有组合结果。 样例:给定 n = 3, 可生成的组合如下:"((()))", "(()())", "(())()", "()(())", "()()()" 算法:对于给定的n,定义一个result字符串,当字符串中 ...
分类:
其他好文 时间:
2017-09-16 00:31:31
阅读次数:
135
Calculate the (a^n) % b where a, b and n are all 32bit integers. Calculate the (a^n) % b where a, b and n are all 32bit integers. Calculate the (a^n) ...
分类:
其他好文 时间:
2017-09-15 09:59:50
阅读次数:
147
[Problem] Given a 2D grid, each cell is either a wall 2, an house 1 or empty 0 (the number zero, one, two), find a place to build a post office so tha ...
分类:
其他好文 时间:
2017-09-14 00:35:26
阅读次数:
150
1 /** 2 * // This is the interface that allows for creating nested lists. 3 * // You should not implement it, or speculate about its implementation 4 ... ...
分类:
其他好文 时间:
2017-09-13 01:47:27
阅读次数:
253
这里: for(int j = 1;j <= m;j++) result[0][j] = 0x80000000; 不能从0开始,result[0][0]是可以取到的,是0。其他情况取不到才用最小表示。 ...
分类:
其他好文 时间:
2017-09-10 20:45:59
阅读次数:
113
注意j-A[i-1]必须大于等于0,只大于0会报错 ...
分类:
其他好文 时间:
2017-09-10 19:49:24
阅读次数:
224
Given a sorted array of n integers, find the starting and ending position of a given target value. If the target is not found in the array, return [-1 ...
分类:
其他好文 时间:
2017-09-08 13:38:35
阅读次数:
161
Given a binary search tree (See Definition) and a node in it, find the in-order successor of that node in the BST. If the given node has no in-order s ...
分类:
其他好文 时间:
2017-09-08 13:31:48
阅读次数:
199
public class Solution { /** * @param num: an integer * @return: an integer, the number of ones in num */ /* 负数的二进制是其绝对值的补码(反码+1) 1 源码: 0001 1 反码: 1110 ...
分类:
其他好文 时间:
2017-09-08 12:03:34
阅读次数:
239