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

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

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

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

代码和注释在这里
边栏推荐
- 提供有效的绩效评估
- After working in the software development industry for six years, I changed my ideas in those years
- Some of my favorite websites
- 新钛云服荣膺“2022爱分析 · IT运维厂商全景报告”云管理平台CMP 代表厂商!...
- Solr基础操作4
- xutils3传集合
- What is online account opening? In addition, is it safe to open a mobile account?
- Software testing interface testing postman testing tool interface testing process execution interface testing interface associated environment variables and global variables built-in dynamic parameter
- Solr basic operation 1
- flutter 插件版本冲突的解决方法
猜你喜欢

Speech signal processing (II): phonation physiology, auditory physiology and auditory psychology

LC: maximum subarray and

大厂试水 HPE推出Arm CPU通用服务器产品

机器学习:VC维的概念和用途

为什么 JSX 语法这么香?

Pain points and solutions of M1 notebook home office | community essay solicitation

Wechat applet: picture seconds plus watermark generation

【一起上水硕系列】Day 8

Yunhe enmo, gaiguoqiang, identify it and grasp it before the domestic database boils

疫情下我离职一年,收入增长了10倍
随机推荐
Xutils3 transfer set
Speech signal processing (III): speech signal analysis [continuous "analog signal" -- Sampling, quantization, coding -- > discrete "digital signal"]
Leetcode 1385. Distance value between two arrays
Is it safe to open a stock account? Shanghai stock account opening.
二叉树的序列化 力扣 297. 二叉树的序列化与反序列化 652. 寻找重复的子树
Solr basic operation 2
大学里遗憾的事,希望你无怨也无悔
[leetcode] a number that appears only once [136]
Matplotlib histogram of Matplotlib visualization plt bar()
提供有效的绩效评估
CE second operation
Pain points and solutions of M1 notebook home office | community essay solicitation
Leetcode(680)——验证回文字符串 Ⅱ
Halcon实用:焊点检出设计思路
PROJECT #1 - BUFFER POOL [CMU 15-445645]笔记
matlab习题 —— 程序控制流程练习
2022 PMP project management examination agile knowledge points (5)
Solr basic operation
Procurement intelligence is about to break out, and the "3+2" system of Alipay helps enterprises build core competitive advantages
333333333333333333333333333333