会员
众包
新闻
博问
闪存
赞助商
HarmonyOS
Chat2DB
所有博客
当前博客
我的博客
我的园子
账号设置
会员中心
简洁模式
...
退出登录
注册
登录
红桃J
用心写好每行完美的代码,远比写一堆更有价值
博客园
::
首页
::
博问
::
闪存
::
新随笔
::
联系
::
订阅
::
管理
::
公告
2015年4月15日
并没有看起来那么简单leetcode Generate Parentheses
摘要: 问题解法参考它给出了这个问题的探讨。超时的代码:这个当n等于7时,已经要很长时间出结果了。这个算法的复杂度是O(n^2)。#include#include#include#includeusing namespace std;bool isValid(string s) { map smap;...
阅读全文
posted @ 2015-04-15 11:37 红桃J
阅读(157)
评论(0)
推荐(0)
leetcode Valid Parentheses
摘要: 代码: 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...
阅读全文
posted @ 2015-04-15 10:31 红桃J
阅读(102)
评论(0)
推荐(0)
leetcode Merge Two Sorted Lists
摘要: 代码: 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 }...
阅读全文
posted @ 2015-04-15 00:44 红桃J
阅读(142)
评论(0)
推荐(0)
leetcode Letter Combinations of a Phone Number
摘要: 对这种问题进行一下小结也算是对昨天写错leetcode Generate Parentheses的一个反省。这也是一个用递归去填数组的问题,在这里就意识到了一次递归填一个,可能是受到这个题的影响所以才会出现在leetcode Generate Parentheses里的问题,果然和大神们还是有不小差...
阅读全文
posted @ 2015-04-15 00:00 红桃J
阅读(146)
评论(0)
推荐(0)