2014年7月30日
摘要: Remove Duplicates from Sorted Array IIFollow up for "Remove Duplicates":What if duplicates are allowed at mosttwice?For example,Given sorted array A =... 阅读全文
posted @ 2014-07-30 18:45 晓O(∩_∩)O~ 阅读(183) 评论(0) 推荐(0) 编辑
摘要: 题目描述:Given a linked list, return the node where the cycle begins. If there is no cycle, returnnull.Follow up:Can you solve it without using extra spac... 阅读全文
posted @ 2014-07-30 16:31 晓O(∩_∩)O~ 阅读(219) 评论(0) 推荐(0) 编辑
摘要: 这两天在做leetcode的题目,最大矩形的题目以前遇到很多次了,一直都是用最笨的方法,扫描每个柱子,变换宽度,计算矩形面积,一直都以为就这样O(n2)的方法了,没有想到居然还有研究出了O(n)的算法,真是对GeeksForGeeks大神膜拜啊。首先是Largest Rectangle in His... 阅读全文
posted @ 2014-07-30 15:37 晓O(∩_∩)O~ 阅读(221) 评论(0) 推荐(0) 编辑
摘要: 研究了一下便于记忆的两种回文字串方法,代码如下:#include #include using namespace std;//最大回文字串,有如下方法://http://blog.csdn.net/linulysses/article/details/5634104//动态规划法/*xPy肯定不是... 阅读全文
posted @ 2014-07-30 15:17 晓O(∩_∩)O~ 阅读(242) 评论(0) 推荐(0) 编辑