当前位置:网站首页>leetcode刷题记录
leetcode刷题记录
2022-07-23 14:13:00 【Five6667】
上链接
https://leetcode.cn/problems/longest-substring-without-repeating-characters/
滑动窗口模板。
class Solution:
def lengthOfLongestSubstring(self, s: str) -> int:
cur, res = [], 0
for r in range(len(s)):
while s[r] in cur:
cur.pop(0) # 左边出
cur.append(s[r]) # 右侧无论如何都会进入新的
res = max(len(cur),res)
return res
边栏推荐
- AutoCAD进阶操作
- ROS2自学笔记:Rviz可视化工具
- CSR、SSR 与 SSG
- 微机原理与技术接口课后作业总结
- Keil errors and solutions (1): fcarm - output name not specified, please check 'options for target - Utilities‘
- oracle 数据库 11C 之后版本使用 memory_target 自动内存管理
- pip报错Could not find a version that satisfies the...No matching distribution
- keras——accuracy_score公式
- MySQL 啥时候用表锁,啥时候用行锁?
- 软件配置 | Pycharm下载、安装及环境配置和卸载
猜你喜欢

【Web漏洞探索】SQL注入漏洞

ROS2自学笔记:RQT可视化工具

PMP每日一练 | 考试不迷路-7.23

智慧物联网源码 带组态物联网源码 工业物联网源码:支持传感器解析服务,数据实时采集和远程控制

IR drop, EM, noise and antenna

微机原理与技术接口随堂练习

通过SSH方式访问内网RDS+mysql

MongoDB数据库+图形化工具下载安装及使用

Add dependent jar packages to the project in the idea

Acquisition of positional reliability in accurate target detection
随机推荐
灰色预测(MATLAB)
JMeter之函数二次开发/插件开发(细版)
Weisfeiler Lehman graph isomorphism test and others
Pinduoduo app product details interface to obtain activity_ ID value (pinduoduo activity_id interface)
数组和特殊矩阵的压缩存储
解决data functions should return an object 并(Property “visible“ must be accessed with “$data.visible“)
死磕遞歸1:遞推公式
C语言基础篇 —— 2-4 指针的数据类型含义和强制类型转换的解析
AutoCAD基本操作
[MySQL]一、MySQL起步
VSCode PIO创建工程失败分析和解决办法
ROS2自学笔记:Rviz可视化工具
Ie box model and standard box model
浏览器同源策略
Shell | 查看进程的方法的不完全总结
微机原理与技术接口课后作业总结
Lake Shore—EMPX-H2 型低温探针台
MongoDB数据库+图形化工具下载安装及使用
Récursion des bosses 1: formule récursive
IR drop, EM, noise and antenna