Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 42d72e2

Browse files
update:0151.翻转字符串里的单词.md java 版本,增加解法四
时间复杂度 O(n) 参考卡哥 c++ 代码的实现:先移除多余空格,再将整个字符串反转,最后把单词逐个反转 有别于解法一 :没有用 StringBuilder 实现,而是对 String 的 char[] 数组操作来实现以上三个步骤
1 parent e9a164a commit 42d72e2

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

‎problems/0151.翻转字符串里的单词.md‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,8 @@ class Solution {
363363
```java
364364
/*
365365
* 解法四:时间复杂度 O(n)
366-
* 参考卡哥 c++ 代码的实现:先移除多余空格,再将整个字符串反转,最后把单词逐个反转
366+
* 参考卡哥 c++ 代码的三步骤:先移除多余空格,再将整个字符串反转,最后把单词逐个反转
367+
* 有别于解法一 :没有用 StringBuilder 实现,而是对 String 的 char[] 数组操作来实现以上三个步骤
367368
*/
368369
class Solution {
369370
//用 char[] 来实现 String 的 removeExtraSpaces,reverse 操作

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /