当前位置:网站首页>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
边栏推荐
- LabVIEW用高速数据流盘
- Collection delete element technique removeif
- 都说验证码是爬虫中的一道坎,看我只用五行代码就突破它。
- How to remove the blank at the top of listview
- About optimizing API interface response speed
- 2022年高考量化卷|请各位量化考生答题
- LabVIEW打开其他EXE程序
- Openresty installation
- 30 | how to reset the consumer group displacement?
- [fireworks in the sky] it's beautiful to light up the night sky with gorgeous fireworks. A programmer brought a fireworks show to pay New Year's greetings to everyone~
猜你喜欢

【Opencv实战】这个印章“神器”够牛,节省了时间提高了效率,厉害~(附完整源码)

vtk. VTP download in JS

【Pygame小游戏】来了来了它来了——这款五子棋小游戏超A的,分享给你的小伙伴儿一起pk吧~

30 | how to reset the consumer group displacement?

【Pygame小游戏】Chrome上的小恐龙竟可以用代码玩儿了?它看起来很好玩儿的样子~

LabVIEW pictures look bright or dark after being cast from 16 bits to 8 bits
![[pyGame games] here it is. This Gobang game is super A. share it with your friends~](/img/76/faea3558ed6fadff755c517922088b.png)
[pyGame games] here it is. This Gobang game is super A. share it with your friends~

【Pygame小游戏】剧情流推荐:什么样的游戏才能获得大家的喜欢呢?(魔鬼恋人、霸总娇妻版)

Unity script cannot display Chinese comments of C # source code or the script created by vs does not have comments of C # source code

【 pygame Games 】 don't find, Leisure Games Theme come 丨 Bubble Dragon applet - - Leisure Games Development recommendation
随机推荐
Is it safe to open an account online in Shanghai?
csdn每日一练——找出最接近元素并输出下标
Common settings for vs
【Pygame小游戏】这款经典的炸弹人超能游戏上线,你爱了嘛?(附源码)
LabVIEW and VDM extract color and generate gray image
基于CenterOS7安装Redis及常见问题解决(带图讲解)
Why many new websites are not included by search engines
LabVIEW改变Point ROI Overlay的形状或颜色
Difference between oscilloscope and spectrum analyzer
长投学堂开户安全吗?靠谱吗?
LabVIEW 禁止其他可多核心处理的应用程序在所有核心上执行
How to generate automatic references (simple drawings)
MySQL command line import and export data
[pyGame games] story stream recommendation: what kind of games can you like? (devil lover, bully's wife version)
SystemVerilog (x) - user defined type
干货丨MapReduce的工作流程是怎样的?
[latex] latex vs Code Snippets
Is it safe for changtou school to open an account? Is it reliable?
Multipartfile rename upload
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