problem:
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...
分类:
其他好文 时间:
2015-04-15 17:03:24
阅读次数:
91
Evaluate Reverse Polish Notation
Evaluate the value of an arithmetic expression in Reverse Polish Notation.
Valid operators are +, -, *, /.
Each operand may be an integer or another expres...
分类:
其他好文 时间:
2015-04-15 11:27:46
阅读次数:
132
代码: 1 #include 2 #include 3 #include 4 5 using namespace std; 6 7 bool isValid(string s) { 8 map smap; 9 smap.insert(make_pair('(', ')'));10...
分类:
其他好文 时间:
2015-04-15 11:19:22
阅读次数:
159
题目链接:Validate Binary Search Tree
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 ...
分类:
其他好文 时间:
2015-04-14 21:41:20
阅读次数:
118
/*给一个不完整的数独,'.'代表为空判断数独是否合法*/public class Solution { public boolean check1(char[][] board){ for(int i = 0 ; i < 9 ; i ++){ int[] ...
分类:
其他好文 时间:
2015-04-14 16:13:00
阅读次数:
108
Given a string containing just the characters'('and')', find the length of the longest valid (well-formed) parentheses substring.For"(()", the longest...
分类:
其他好文 时间:
2015-04-14 14:35:10
阅读次数:
121
Given a string containing just the characters'(',')','{','}','['and']', determine if the input string is valid.The brackets must close in the correct ...
分类:
其他好文 时间:
2015-04-14 14:15:23
阅读次数:
108
Valid Pattern LockTime Limit:2 Seconds Memory Limit:65536 KBPattern lock security is generally used in Android handsets instead of a password. The pat...
分类:
其他好文 时间:
2015-04-13 22:51:31
阅读次数:
144
这道题目是队友写的,貌似是用暴力枚举出来。题意:给出一组数,要求这组数在解锁的界面可能的滑动序列。思路:按照是否能够直接到达建图,如1可以直接到2,但是1不能直接到3,因为中间必须经过一个2。要注意的假如2已结访问过,那么1就可以直接到2。建图DFS,图要更新。Source Code:#includ...
分类:
其他好文 时间:
2015-04-13 22:22:32
阅读次数:
140
题目链接:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3861题意:给出一组数,要求这组数在解锁的界面可能的滑动序列。思路:按照是否能够直接到达建图,如1可以直接到2,但是1不能直接到3,因为中间必须经过一个2。要注意的假...
分类:
其他好文 时间:
2015-04-13 20:45:24
阅读次数:
126