摘要:
问题解法参考它给出了这个问题的探讨。超时的代码:这个当n等于7时,已经要很长时间出结果了。这个算法的复杂度是O(n^2)。#include#include#include#includeusing namespace std;bool isValid(string s) { map smap;... 阅读全文
摘要:
代码: 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... 阅读全文
摘要:
代码: 1 #include 2 3 using namespace std; 4 5 struct ListNode { 6 int val; 7 ListNode *next; 8 ListNode(int x) : val(x), next(NULL) {} 9 }... 阅读全文
摘要:
对这种问题进行一下小结也算是对昨天写错leetcode Generate Parentheses的一个反省。这也是一个用递归去填数组的问题,在这里就意识到了一次递归填一个,可能是受到这个题的影响所以才会出现在leetcode Generate Parentheses里的问题,果然和大神们还是有不小差... 阅读全文