链接:https://leetcode.com/problems/wiggle-subsequence/ 解题思路:其实只需要比较a[n+1]-a[n]和a[n]-a[n-1]的正负性即可,定义变量flag记录上一次的正负性,current记录上一个的值,count记录满足要求的总和,于是有以下代码 ...
分类:
其他好文 时间:
2016-08-10 20:56:48
阅读次数:
307
Say you have an array for which the ith element is the price of a given stock on day i. Design an algorithm to find the maximum profit. You may comple ...
分类:
其他好文 时间:
2016-08-09 07:05:48
阅读次数:
201
C - Common Subsequence Time Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64u C - Common Subsequence Description A subsequence of a give ...
分类:
其他好文 时间:
2016-08-08 21:04:16
阅读次数:
229
Delay Constrained Maximum Capacity Path Time Limit: 10000/10000 MS (Java/Others) Memory Limit: 65535/65535 K (Java/Others)Total Submission(s): 1790 Ac ...
分类:
其他好文 时间:
2016-08-08 17:32:33
阅读次数:
178
Subsequence Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 12311 Accepted: 5169 Description A sequence of N positive integers (10 < N < 10 ...
分类:
其他好文 时间:
2016-08-08 17:22:44
阅读次数:
106
376. Wiggle Subsequence 376. Wiggle Subsequence Total Accepted: 5157 Total Submissions: 14616 Difficulty: Medium A sequence of numbers is called a wig ...
分类:
其他好文 时间:
2016-08-07 16:51:15
阅读次数:
113
Subsequence Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 12304 Accepted: 5165 Description A sequence of N positive integers (10 < N < 10 ...
分类:
其他好文 时间:
2016-08-07 12:11:37
阅读次数:
113
Given an unsorted array of integers, find the length of longest increasing subsequence. For example,Given [10, 9, 2, 5, 3, 7, 101, 18],The longest inc ...
分类:
其他好文 时间:
2016-08-07 06:24:00
阅读次数:
195
PHP配置文件的参数max_execution_time表示脚本执行超时时间 max_execution_time=0表示不限制 max_execution_time=2表示执行两秒后终止,同时报错Fatal error: Maximum execution time of 2 seconds ex ...
分类:
Web程序 时间:
2016-08-05 19:37:00
阅读次数:
189