• 博客园logo
  • 会员
  • 众包
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • HarmonyOS
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
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 阅读(183) 评论(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 阅读(121) 评论(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 阅读(110) 评论(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 阅读(197) 评论(0) 推荐(0)
 
 

公告


博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3