修改错别字. “左闭又闭”应该是“左闭右闭”
This commit is contained in:
parent
ad558b08e1
commit
4e28ab5b7d
|
|
@ -150,7 +150,7 @@ void removeExtraSpaces(string& s) {//去除所有空格并在相邻单词之间
|
|||
代码如下:
|
||||
|
||||
```CPP
|
||||
// 反转字符串s中左闭又闭的区间[start, end]
|
||||
// 反转字符串s中左闭右闭的区间[start, end]
|
||||
void reverse(string& s, int start, int end) {
|
||||
for (int i = start, j = end; i < j; i++, j--) {
|
||||
swap(s[i], s[j]);
|
||||
|
|
@ -163,7 +163,7 @@ void reverse(string& s, int start, int end) {
|
|||
```CPP
|
||||
class Solution {
|
||||
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--) {
|
||||
swap(s[i], s[j]);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue