修复python在md中的语法高亮&代码格式调整

This commit is contained in:
大林程序员
2022-10-08 11:45:40 +08:00
committed by GitHub
parent ef0cb55638
commit a918d6fa07

View File

@ -181,23 +181,23 @@ class Solution:
index += 1 index += 1
return 0 if res==float("inf") else res return 0 if res==float("inf") else res
``` ```
```python3 ```python
#滑动窗口 # 滑动窗口
class Solution: class Solution:
def minSubArrayLen(self, target: int, nums: List[int]) -> int: def minSubArrayLen(self, target: int, nums: List[int]) -> int:
if nums is None or len(nums)==0: if nums is None or len(nums) == 0:
return 0 return 0
lenf=len(nums)+1 lenf = len(nums) + 1
total=0 total = 0
i=j=0 i = j = 0
while (j<len(nums)): while (j < len(nums)):
total=total+nums[j] total = total + nums[j]
j+=1 j += 1
while (total>=target): while (total >= target):
lenf=min(lenf,j-i) lenf = min(lenf, j - i)
total=total-nums[i] total = total - nums[i]
i+=1 i += 1
if lenf==len(nums)+1: if lenf == len(nums) + 1:
return 0 return 0
else: else:
return lenf return lenf