题目链接:点击打开链接
每个点都是最大值,把一整个序列和都压缩在一个点里。
#include
#include
#include
#include
#include
using namespace std;
#define N 100005
#define Lson(x) (x<<1)
#define Rson(x) (x<<1|1)
#define L(x) tre...
分类:
其他好文 时间:
2014-08-31 14:33:31
阅读次数:
169
Given an array of integers, every element appearsthreetimes except for one. Find that single one.Note:Your algorithm should have a linear runtime comp...
分类:
其他好文 时间:
2014-08-31 14:27:21
阅读次数:
146
引言既上一篇 子集系列(一)后,这里我们接着讨论带有附加条件的子集求解方法。这类题目也是求子集,只不过不是返回所有的自己,而往往是要求返回满足一定要求的子集。解这种类型的题目,其思路可以在上一篇文章的思路略作改进。例 1,求元素数量为定值的所有子集CombinationsGiven two inte...
分类:
其他好文 时间:
2014-08-31 07:06:10
阅读次数:
304
当我们需要获取未来某个时间的毫秒数时,可能第一时间想到的方法是(new Date("2014-12-08 12:00:00")).getTime()这个在方法在chrome下是会返回一个数字的。但是在IE下返回的是一个NaN,是因为IE下认为 YYYY-mm-dd HH:ii:ss不是一个合理的日期...
分类:
编程语言 时间:
2014-08-31 02:45:10
阅读次数:
272
题意:给定一个单链表,判断该链表中是否存在环,如果存在,返回环开始的节点
思路:
1.定义两个指针,快指针fast每次走两步,慢指针s每次走一次,如果它们在非尾结点处相遇,则说明存在环
2.若存在环,设环的周长为r,相遇时,慢指针走了 slow步,快指针走了 2s步,快指针在环内已经走了 n环,
则有等式 2s = s + nr => s = nr
3.在相遇的时候,另设一个每次走一步的慢指针slow2从链表开头往前走。因为 s = nr,所以两个慢指针会在环的开始点相遇
复杂度:时间O(n)
struct...
分类:
其他好文 时间:
2014-08-30 23:07:40
阅读次数:
187
烃类蒸汽转化炉的炉膛截面评级程序REFORM-3PC.V7.0+FRNC-5PC.V8.0 通用加热炉工艺计算软件KBC Petro-SIM Suite v4.0 SP2-ISO 1CD(炼油工艺流程模拟软件)FRNC-5PC.V8.0 通用加热炉工艺计算软件CAESAR II 2013 R1 v....
分类:
其他好文 时间:
2014-08-30 11:04:29
阅读次数:
296
There is a fire in LTR ’ s home again. The fire can destroy all the things in
t seconds, so LTR has to escape in t seconds. But there are some jewels in LTR ’ s rooms, LTR love jewels very much so h...
分类:
其他好文 时间:
2014-08-29 22:45:58
阅读次数:
308
leetcode上有四道关于移除有序序列中重复数字的题目,其中两道为数组结构,两道为链表结构,分别为:
(1)Remove Duplicates from sorted array I:移除一个有序数组中的重复数字,并且返回新数组的大小。
(2)Remove Duplicates from sorted array II:移除一个有序数组中的重复数字,并且返回新数组的大小,和上道题目不同的是每...
分类:
其他好文 时间:
2014-08-29 18:24:28
阅读次数:
289
本文为senlie原创,转载请保留此地址:http://blog.csdn.net/zhengsenlie
Unique Paths II
Total Accepted: 13655 Total
Submissions: 49081My Submissions
Follow up for "Unique Paths":
Now consider i...
分类:
其他好文 时间:
2014-08-29 16:12:34
阅读次数:
236
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 space?题目意...
分类:
其他好文 时间:
2014-08-29 12:44:37
阅读次数:
256