当前位置:网站首页>Leetcode-209 minimum length subarray
Leetcode-209 minimum length subarray
2022-06-11 00:03:00 【It was the sea】

class Solution(object):
def minSubArrayLen(self, target, nums):
"""
:type target: int
:type nums: List[int]
:rtype: int
"""
if not nums:
return 0
n = len(nums)
ans = n + 1
start, end = 0, 0
total = 0
while end < n:
total += nums[end]
while total >= target:
ans = min(ans, end - start + 1)
total -= nums[start]
start += 1
end += 1
return 0 if ans == n + 1 else ans
边栏推荐
- [opencv practice] this seal "artifact" is awesome, saving time and improving efficiency. It is powerful ~ (complete source code attached)
- [AI card player] for the first time to see such an "exciting" landowner, the key factor for a high winning rate is
- curl导入postman报错小记
- Merge sort
- How to remove the blank at the top of listview
- LabVIEW中创建毫秒时间标识
- 快速排序
- 【Pygame小游戏】《坦克大战》,那些童年的游戏你还记得几个呢?
- 【Opencv实战】这个印章“神器”够牛,节省了时间提高了效率,厉害~(附完整源码)
- LabVIEW 禁止其他可多核心处理的应用程序在所有核心上执行
猜你喜欢

Hyperleger fabric installation

【漫天烟花】绚烂烟花点亮夜空也太美了叭、某程序员携带烟花秀给大家拜年啦~

LabVIEW和VDM提取色彩和生成灰度图像

LabVIEW改变Point ROI Overlay的形状或颜色

都说验证码是爬虫中的一道坎,看我只用五行代码就突破它。

Ilruntime hotfix framework installation and breakpoint debugging

示波器刷新率怎么测量

LabVIEW用VISA Read函数来读取USB中断数据

IGBT与三代半导体SiC双脉冲测试方案
![[pyGame games] in the first month, it broke 100 million to download a masterpiece that is highly integrated with](/img/f5/d947f5e5c2abf79c0fac2f45103ec0.png)
[pyGame games] in the first month, it broke 100 million to download a masterpiece that is highly integrated with "super casual game features"~
随机推荐
Analysis of Genesis public chain
【Turtle表白合集】“海底月是天上月,眼前人是心上人。”余生多喜乐,长平安~(附3款源码)
A simple understanding of B tree
LabVIEW programming specification
LabVIEW uses the visa read function to read USB interrupt data
LabVIEW编程规范
Dark horse headlines - Tencent's salary system reform has caused controversy; Intel expanded the recruitment of female engineers nationwide; Black horse is 100% employed really
【Pygame小游戏】来了来了它来了——这款五子棋小游戏超A的,分享给你的小伙伴儿一起pk吧~
[appearance detection artifact] come on, please show me your unique skill (is this appearance worthy of the audience?)
【LaTex】latex VS Code snippets(代码片段)
LabVIEW 禁止其他可多核心处理的应用程序在所有核心上执行
LabVIEW open other exe programs
Top ten information security principles
30 | 怎么重设消费者组位移?
Redis installation and common problem solving based on centeros7 (explanation with pictures)
【Pygame小游戏】剧情流推荐:什么样的游戏才能获得大家的喜欢呢?(魔鬼恋人、霸总娇妻版)
示波器刷新率怎么测量
Why many new websites are not included by search engines
[auto reply Script] happy new year. I typed every word myself, not forwarded it~
LabVIEW pictures look bright or dark after being cast from 16 bits to 8 bits