mirror of
https://github.com/youngyangyang04/leetcode-master.git
synced 2025-07-08 00:43:04 +08:00
修改错别字. “左闭又闭”应该是“左闭右闭”
This commit is contained in:
@ -150,7 +150,7 @@ void removeExtraSpaces(string& s) {//去除所有空格并在相邻单词之间
|
|||||||
代码如下:
|
代码如下:
|
||||||
|
|
||||||
```CPP
|
```CPP
|
||||||
// 反转字符串s中左闭又闭的区间[start, end]
|
// 反转字符串s中左闭右闭的区间[start, end]
|
||||||
void reverse(string& s, int start, int end) {
|
void reverse(string& s, int start, int end) {
|
||||||
for (int i = start, j = end; i < j; i++, j--) {
|
for (int i = start, j = end; i < j; i++, j--) {
|
||||||
swap(s[i], s[j]);
|
swap(s[i], s[j]);
|
||||||
@ -163,7 +163,7 @@ void reverse(string& s, int start, int end) {
|
|||||||
```CPP
|
```CPP
|
||||||
class Solution {
|
class Solution {
|
||||||
public:
|
public:
|
||||||
void reverse(string& s, int start, int end){ //翻转,区间写法:左闭又闭 []
|
void reverse(string& s, int start, int end){ //翻转,区间写法:左闭右闭 []
|
||||||
for (int i = start, j = end; i < j; i++, j--) {
|
for (int i = start, j = end; i < j; i++, j--) {
|
||||||
swap(s[i], s[j]);
|
swap(s[i], s[j]);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user