会员
周边
众包
新闻
博问
闪存
赞助商
所有博客
当前博客
我的博客
我的园子
账号设置
简洁模式
...
退出登录
注册
登录
yanqi
博客园
|
首页
|
新随笔
|
新文章
|
联系
|
订阅
|
管理
2015年11月19日
LeetCode() Minimun Size Subarray Sum
摘要: 别人的代码class Solution {public: int minSubArrayLen(int s, vector& nums) { int l, r, cum, res = nums.size()+1; l = r = cum = 0; while ((u...
阅读全文
posted @ 2015-11-19 22:43 yanqi
阅读(177)
评论(0)
推荐(0)
编辑
LeetCode() First Missing Positive
摘要: 非常内疚,没想到这样的思路。思路:把数组上某一个位置的值放到正确的地方上去(nums[i-1] == i),nums[i] >0 && & A) { int i = 0; int n=A.size(); for (; i n || A[i] == A[A[i]...
阅读全文
posted @ 2015-11-19 19:27 yanqi
阅读(117)
评论(0)
推荐(0)
编辑
Next Permutation 思想
摘要: 函数实现原理如下:在当前序列中,从尾端向前寻找两个相邻元素,前一个记为*i,后一个记为*t,并且满足*i & nums) { if(nums.size()=0;i--) if(nums[i]i;k--) if(nums[k]>nums[i])...
阅读全文
posted @ 2015-11-19 14:22 yanqi
阅读(105)
评论(0)
推荐(0)
编辑
LeetCode() Find the Duplicate Number
摘要: Given an arraynumscontainingn+ 1 integers where each integer is between 1 andn(inclusive), prove that at least one duplicate number must exist. Assume...
阅读全文
posted @ 2015-11-19 13:43 yanqi
阅读(189)
评论(0)
推荐(0)
编辑
公告