为了在运行中避免可能出现的危险,即当string emuStack为空,emuStack.begin()和emuStack.end()是什么。采取的策略是先将emuStack重置为非空,再进行其他操作,这样就永远不可能碰到底部。
#include
#include
using namespace std;
class Solution {
public:
bool isValid(st...
分类:
其他好文 时间:
2015-06-06 09:18:14
阅读次数:
108
L93: Restore IP Addresses
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.2...
分类:
其他好文 时间:
2015-06-05 22:43:06
阅读次数:
154
Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases.For example,"A man, a plan, a canal: Pana...
分类:
其他好文 时间:
2015-06-05 21:00:56
阅读次数:
109
Valid Parentheses
题目:
Given a string containing just the characters ‘(‘, ‘)’, ‘{‘, ‘}’, ‘[’ and ‘]’, determine if the input string is valid.
The brackets must close in the correct order, “()”...
分类:
其他好文 时间:
2015-06-05 14:07:10
阅读次数:
117
此Demo有一个奇葩的bug
06-05 12:50:44.955: E/AndroidRuntime(16374): Caused by: android.view.WindowManager$BadTokenException: Unable to add window -- token android.os.BinderProxy@41d0c028 is not valid; is you...
分类:
其他好文 时间:
2015-06-05 14:02:33
阅读次数:
134
Evaluate the value of an arithmetic expression in Reverse Polish Notation.Valid operators are +, -, *, /. Each operand may be an integer or another ex...
分类:
编程语言 时间:
2015-06-05 11:34:10
阅读次数:
147
题目:Given a stringsand a dictionary of wordsdict, add spaces insto construct a sentence where each word is a valid dictionary word.Return all such poss...
分类:
其他好文 时间:
2015-06-05 08:44:54
阅读次数:
115