当前位置:网站首页>6.28日刷题题解
6.28日刷题题解
2022-06-29 23:38:00 【终究还是一人独行】
今天在力扣上按顺序刷了两道题目。
第一道题是反转链表。

这是题目,
我是使用了一次遍历。然后用两个节点一个节点用来记录下一次节点。一个节点用来录上一个节点。 然后把正在遍历的节点的指针指向上一个节点。然后遍历到最后一个 就可以把所有节点的指针倒转过来。

具体的代码和注释就是这个样子。
第二道题目是无重复字符的最长子串。

这里的题目是用一种名叫滑动窗口的思想来做的。就是如果我想将一个已经在子串中有重复字母的字母加进去。 那我就要把这个字符串中重复字符和其之前的所有字符全部移除出去才可以加入这个字符成为一个没有任何重复字符的字符串,然后我就使用了一个vector容器来记录下每个字符在字符串中的位置。然后用这个容器来进行判断和更新。每次加入重复字符就更新新维克托容器里的值。然后使用max函数来找到遍历过程中的最大值。

代码和注释在这里
边栏推荐
- Pytest initializing and cleaning up the environment
- @Scheduled annotation pit, I stepped on it for you
- 软件测试 接口测试 Jmeter 5.5 安装教程
- 采购数智化爆发在即,支出宝“3+2“体系助力企业打造核心竞争优势
- The concept and significance of mean, variance, standard deviation and covariance
- label問題排查:打不開標注好的圖像
- 成为唯一的key
- 小程序插件接入、开发与注意事项
- After working in the software development industry for six years, I changed my ideas in those years
- FPGA开发(1)——串口通信
猜你喜欢

疫情下我离职一年,收入增长了10倍

Incluxdb time series database system

Software testing interface testing JMeter 5.5 installation tutorial

“微博评论”的高性能高可用计算架构

Matplotlib plt Hist() parameter explanation

Procurement intelligence is about to break out, and the "3+2" system of Alipay helps enterprises build core competitive advantages

FPGA开发(1)——串口通信

CE second operation

Gracefully transform the SMS business module and start the strategic mode!

Remember the process of checking online MySQL deadlock. You should not only know curd, but also know the principle of locking
随机推荐
Solr基础操作5
除子
Leetcode(633)——平方数之和
绿树公司官方网站
Some of my favorite websites
LC: effective Sudoku + rotating image
Leetcode(680)——验证回文字符串 Ⅱ
自己收藏的一些网址
AI empowers new retail, the way to win "wisdom" lies in ecological thinking | selected excerpts from digital intelligence night talk live broadcast
软件测试 接口测试 Postman测试工具 接口测试的流程 执行接口测试 接口关联 环境变量和全局变量 内置动态参数以及自动有的动态参数
Incluxdb time series database system
Sword finger offer 38 Arrangement of strings
Yunhe enmo, gaiguoqiang, identify it and grasp it before the domestic database boils
提供有效的绩效评估
Regular expressions: characters (2)
简单理解B树和B+树
Matplotlib plt Hist() parameter explanation
动态代理的实现原理
基金的信息披露
架构实战营模块5作业