mirror of
https://github.com/youngyangyang04/leetcode-master.git
synced 2025-07-09 11:34:46 +08:00
update 0541.反转字符串II:添加复杂度分析
This commit is contained in:
@ -65,6 +65,9 @@ public:
|
|||||||
};
|
};
|
||||||
```
|
```
|
||||||
|
|
||||||
|
* 时间复杂度: O(n)
|
||||||
|
* 空间复杂度: O(1)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -96,6 +99,9 @@ public:
|
|||||||
};
|
};
|
||||||
```
|
```
|
||||||
|
|
||||||
|
* 时间复杂度: O(n)
|
||||||
|
* 空间复杂度: O(1)或O(n), 取决于使用的语言中字符串是否可以修改.
|
||||||
|
|
||||||
|
|
||||||
另一种思路的解法
|
另一种思路的解法
|
||||||
|
|
||||||
@ -116,6 +122,9 @@ public:
|
|||||||
};
|
};
|
||||||
```
|
```
|
||||||
|
|
||||||
|
* 时间复杂度: O(n)
|
||||||
|
* 空间复杂度: O(1)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## 其他语言版本
|
## 其他语言版本
|
||||||
|
Reference in New Issue
Block a user