public class Solution { public List generateParenthesis(int n) { List result = new ArrayList(); Stack numStack = new Stack(); ...
分类:
其他好文 时间:
2014-09-06 01:00:42
阅读次数:
186
说说:
题意就是由字符串中的[]()匹不匹配的问题。解法很简单,搞个栈就搞定了。但是题目中有一个陷阱,那就是字符串为空也是合理的。所以在读取字符串的时候最好使用gets,因为scanf会自动将换行给忽略掉的。
源代码:
#include
#include
#define MAXN 128+5
int main(){
char stack[MAXN],c,s[MAXN];
...
分类:
其他好文 时间:
2014-09-05 19:56:31
阅读次数:
163
前两周,由于数据库简繁体的转换,大量的数据库需要转到新的服务器。 在转其中的一台的时候,原先导出来的JOBS脚本不翼而飞(原因至今未明),而恰巧这一台服务器有90多个JOB(看下图恢复后的,注意滚动条的长短),这样一来,可急坏了人了。 这么多的JOB要一个一个建立,时间去了不说,有些JOB根本不知道...
分类:
数据库 时间:
2014-09-05 12:53:51
阅读次数:
369
Givennpairs of parentheses, write a function to generate all combinations of well-formed parentheses.For example, givenn= 3, a solution set is:"((()))...
分类:
其他好文 时间:
2014-09-04 22:17:00
阅读次数:
185
Givenn, generate all structurally uniqueBST's(binary search trees) that store values 1...n.For example,Givenn= 3, your program should return all 5 uni...
分类:
其他好文 时间:
2014-09-04 18:52:29
阅读次数:
181
We've got a large system that's loosely bound to its data source (Navision) via Unity - we're getting the opportunity to swap it out and have our own ...
分类:
系统相关 时间:
2014-09-04 09:32:57
阅读次数:
299
public class Solution { public List> generate(int numRows) { List> result = new ArrayList>(); if (numRows oldLine = new ArrayList();...
分类:
其他好文 时间:
2014-09-04 02:47:37
阅读次数:
252
Given a string containing just the characters '(' and ')', find the length of the longest valid (well-formed) parentheses substring.For "(()", the lon...
分类:
其他好文 时间:
2014-09-03 22:30:07
阅读次数:
211
Pascal's TriangleGivennumRows, generate the firstnumRowsof Pascal's triangle.For example, givennumRows= 5,Return[ [1], [1,1], [1,2,1], [1,3,...
分类:
其他好文 时间:
2014-09-03 16:46:16
阅读次数:
183
Given a string containing just the characters'('and')', find the length of the longest valid (well-formed) parentheses substring.For"(()", the longest...
分类:
其他好文 时间:
2014-09-03 10:59:16
阅读次数:
183