mirror of
https://github.com/youngyangyang04/leetcode-master.git
synced 2025-07-08 16:54:50 +08:00
Update
This commit is contained in:
@ -14,7 +14,7 @@
|
||||
你不能只是单纯的改变节点内部的值,而是需要实际的进行节点交换。
|
||||
|
||||
|
||||

|
||||
<img src='https://code-thinking.cdn.bcebos.com/pics/24.%E4%B8%A4%E4%B8%A4%E4%BA%A4%E6%8D%A2%E9%93%BE%E8%A1%A8%E4%B8%AD%E7%9A%84%E8%8A%82%E7%82%B9-%E9%A2%98%E6%84%8F.jpg' width=600 alt='24.两两交换链表中的节点-题意'> </img></div>
|
||||
|
||||
## 思路
|
||||
|
||||
|
@ -46,7 +46,7 @@ https://leetcode-cn.com/problems/reverse-string-ii/
|
||||
|
||||
使用C++库函数reverse的版本如下:
|
||||
|
||||
```
|
||||
```C++
|
||||
class Solution {
|
||||
public:
|
||||
string reverseStr(string s, int k) {
|
||||
@ -68,7 +68,8 @@ public:
|
||||
那么我们也可以实现自己的reverse函数,其实和题目[344. 反转字符串](https://mp.weixin.qq.com/s/X02S61WCYiCEhaik6VUpFA)道理是一样的。
|
||||
|
||||
下面我实现的reverse函数区间是左闭右闭区间,代码如下:
|
||||
```
|
||||
|
||||
```C++
|
||||
class Solution {
|
||||
public:
|
||||
void reverse(string& s, int start, int end) {
|
||||
|
Reference in New Issue
Block a user