未验证 提交 785f48ba 编写于 作者: Y YiliaZhang 提交者: GitHub

Update 剑指 offer 题解.md

5. 替换空格   在for (int i = 0; i < str.length( ); i++)中,str还在一直append,for循环出不去,最终会报OOM
上级 9e987425
......@@ -230,7 +230,7 @@ Output:
```java
public String replaceSpace(StringBuffer str) {
int P1 = str.length() - 1;
for (int i = 0; i < str.length(); i++)
for (int i = 0; i < P1+1; i++)
if (str.charAt(i) == ' ')
str.append(" ");
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册