Given a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid.
The brackets must close in t...
分类:
其他好文 时间:
2015-01-24 01:35:02
阅读次数:
173
# -*- coding: utf8 -*-'''__author__ = 'dabay.wang@gmail.com'20: Valid Parentheseshttps://oj.leetcode.com/problems/valid-parentheses/Given a string con...
分类:
编程语言 时间:
2015-01-24 00:21:16
阅读次数:
364
【题目】
Given a string containing just the characters '(', ')', '{', '}', '[' and ']',
determine if the input string is valid.
The brackets must close in the correct order, "()" and "()[]{}" ar...
分类:
其他好文 时间:
2015-01-23 21:34:47
阅读次数:
181
原题链接:https://oj.leetcode.com/problems/valid-parentheses/
检查是否是有效的括号序列。这里的解法是维护一个栈,如果是左括号,则push到栈中,如果是右括号,则检查栈顶的符号,如果是对应的做括号,则将之弹出。否则,则直接返回false。当字符串扫描到尾时,则检查栈是否是空,如果是空,则说明所有的括号都match上了。
clas...
分类:
其他好文 时间:
2015-01-23 16:30:25
阅读次数:
178
原题地址一道考察"工程"能力的好题,但是你丫能说明一下规则不。。用状态机求解:当遍历完字符串后:1. 绿色的状态至少要出现1个2. 红色的状态不能作为终结状态代码: 1 enum Status { 2 PRE_PADDING, 3 SIGN, 4 NUMBER_BEFORE_POINT,...
分类:
其他好文 时间:
2015-01-23 16:09:10
阅读次数:
199
原题地址方法I:动态规划len[i]表示从i开始到结束的最长合法括号串长度,则:如果s[i] == "(" 且 s[i+len[i+1]+1]==")",len[i] = len[i+1] + 2否则len[i] = 0方法II:辅助栈跟那个直方图求最大面积有点类似,用一个栈保存合法括号串的长度,显...
分类:
其他好文 时间:
2015-01-23 06:10:15
阅读次数:
138
Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases.
For example,
"A man, a plan, a canal: Panama" is a palindrome.
"race a car" is not a...
分类:
其他好文 时间:
2015-01-22 21:57:56
阅读次数:
361
今天下午对面的老大调试遇到这个问题,大家一起讨论好久才解决这个问题
crt源代码都是可以看到的,为了了解清楚原因,十分有必要查看源码,源码一般在你的VS安装路径下VC\crt\src下。
点击重试,定位到崩溃源码地方dbgdel.c的第52行。
为了了解原因,我的测试代码是这样写的:
int _tmain(int argc, _TCHAR* argv[])
{
char* p ...
分类:
其他好文 时间:
2015-01-22 20:23:05
阅读次数:
291
matlab
I
The input character is not valid in MATLAB statements or expressions.
今天在用基于区域生长的图像分割法时出现了这个问题,总结一下
解决办法
1.保存的文件名是否非法,不要用汉字保存
2.是否使用了汉字输入Editor
3.imread的图片是否是汉字,数字开头等非法内容...
分类:
其他好文 时间:
2015-01-22 18:06:09
阅读次数:
120
Given a string containing only digits, restore it by returning all possible valid IP address combinations. For example:Given "25525511135",return ["25...
分类:
其他好文 时间:
2015-01-22 15:21:34
阅读次数:
108