【题目】
Validate if a given string is numeric.
Some examples:
"0" => true
" 0.1 " => true
"abc" => false
"1 a" => false
"2e10" => true
Note: It is intended for the problem statement to be ambiguous. You should gather all requirements up front before imple...
分类:
其他好文 时间:
2014-06-04 23:45:09
阅读次数:
388
求最长合法匹配的长度,这道题可以用一维动态规划逆向求解。假设输入括号表达式为String s,维护一个长度为s.length的一维数组dp[],数组元素初始化为0。 dp[i]表示从s[i]到s[s.length - 1]包含s[i]的最长的有效匹配括号子串长度。则存在如下关系:...
分类:
其他好文 时间:
2014-06-04 13:52:03
阅读次数:
279
【题目】原文:1.3 Design an algorithm and write code
to remove the duplicate characters in a string without using any additional
buffer. NOTE: One or two add...
分类:
其他好文 时间:
2014-06-02 21:32:04
阅读次数:
284
【题目】
Given a binary tree, determine if it is a valid binary search tree (BST).
Assume a BST is defined as follows:
The left subtree of a node contains only nodes with keys less than the node's key.
The right subtree of a node contains only nodes with ke...
分类:
其他好文 时间:
2014-06-02 10:29:55
阅读次数:
257
The only syntax difference between JSON and the
object literal is that property names need to be wrapped in quotes to be valid
JSON. In object literal...
分类:
编程语言 时间:
2014-06-02 09:31:41
阅读次数:
394
题目描述:题目描述相当的繁琐
分析:输入保证填词游戏至少有一组答案,这就说明不必寻找单词所在的位置,只要去掉这些单词所占用的字母就可以了。 代码实现一下: #include void
main(){ int characters[26]; int n, m, p; int i, j; for(i =...
分类:
其他好文 时间:
2014-06-02 08:22:49
阅读次数:
208
问题:
在Sudoku
Solver 中说道,会有一些提示解,这里就是验证下给定的提示解是否合法,即已经填加的数是否满足要求的三个条件。
bool isValidSudoku(vector > &board) {
const int M = 9;//9 * 9
const int hash_len = 60;//'0' = 48 + 10
const char do...
分类:
其他好文 时间:
2014-06-02 02:31:45
阅读次数:
279
public void Draw (IGeometry Geometry);public
void QueryBoundary (int hDC,ITransformation displayTransform,IGeometry
Geometry,IPolygon boundary);Valid ...
分类:
其他好文 时间:
2014-06-02 00:06:18
阅读次数:
440
【题目】
Given a string containing only digits, restore it by returning all possible valid IP address combinations.
For example:
Given "25525511135",
return ["255.255.11.135", "255.255.111.35"]. (Order does not matter)
【题意】
给定一个字符串,恢复并返回所有符合条件的IP串
【思路】...
分类:
其他好文 时间:
2014-06-01 13:01:56
阅读次数:
295
题目:
给定一个字符串,返回该串没有重复字符的最长子串。
分析:
1)子串:子串要求是连续的。
2)无重复,出现重复就断了,必须从新的位置开始。而新的位置就是重复字符第一次出现位置的下一个位置。
3)整个串可能没有一处重复。
那么,为了找出当前访问的字符是否出现过,要怎么做呢?当然是hash,O(1)的时间,而且既然是字符, 定义个255的hash table 就可以了,has...
分类:
其他好文 时间:
2014-06-01 10:48:31
阅读次数:
206