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

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

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

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

代码和注释在这里
边栏推荐
- 按头安利 好看又实用的点胶机 SolidWorks模型素材看这里
- Welcome the "top ten" of the Municipal Association for science and technology • pay tribute to Lu Yi, a scientific and technological worker: an explorer guarding the transmission security of the power
- 基金的信息披露
- Head pressing Amway good-looking and practical dispensing machine SolidWorks model material here
- Incluxdb time series database system
- Cacti最大监控数测试
- 关于二叉树
- Principe de réalisation de l'agent dynamique
- 招商证券靠谱吗?开股票账户安全吗?
- Wechat applet: big red festive UI guessing lantern riddles is also called guessing character riddles
猜你喜欢

CE第二次作业

Wechat applet: (update) cloud development wechat group contacts

Open source the Ernie tiny lightweight technology of "Wenxin big model", which is accurate and fast, with full effect

AI赋能新零售,「智」胜之道在于生态思维|数智夜话直播精选摘录
![Project 1 - buffer pool [cmu 15-445645] notes](/img/33/304e3e78f62b156d0863a41d243679.png)
Project 1 - buffer pool [cmu 15-445645] notes

二叉搜索树 230. 二叉搜索树中第K小的元素 1038. 从二叉搜索树到更大和树

均值、方差、标准差、协方差的概念及意义

AI empowers new retail, the way to win "wisdom" lies in ecological thinking | selected excerpts from digital intelligence night talk live broadcast

matplotlib matplotlib可视化之柱状图plt.bar()

Leetcode 1385. 两个数组间的距离值
随机推荐
Is it safe to open a stock account? Shanghai stock account opening.
大厂试水 HPE推出Arm CPU通用服务器产品
Test d'installation du cluster metaq
25 interview questions about Apache
Solution to version conflict of flutter plug-in
Leetcode 1385. 两个数组间的距离值
网上开户选哪个证券公司?还有,在线开户安全么?
基金的估值,费用,会计核算
绿树公司官方网站
High performance and high availability computing architecture of "Weibo comments"
收藏!这些提高程序员生产力的工具你用过吗?
Solr基础操作
HPE launched ARM CPU general server product
Yunhe enmo, gaiguoqiang, identify it and grasp it before the domestic database boils
小程序插件接入、开发与注意事项
C指针进阶1-->字符指针,数组指针,指针与数组传参,函数指针
NRM explanation
大学里遗憾的事,希望你无怨也无悔
Create an API rapid development platform, awesome!
Speech signal processing (III): speech signal analysis [continuous "analog signal" -- Sampling, quantization, coding -- > discrete "digital signal"]