Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 34c745b

Browse files
committedOct 20, 2020
update 05 solution
1 parent f90fa1b commit 34c745b

File tree

2 files changed

+4
-38
lines changed

2 files changed

+4
-38
lines changed
 

‎lcof/of004/README.md

Lines changed: 0 additions & 32 deletions
This file was deleted.

‎lcof/of005/Solution.go

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,17 @@
11
package Solution
22

33
func replaceSpace(s string) string {
4-
result := make([]rune, len(s)*3)
4+
ans := make([]rune, len(s)*3)
55

66
i := 0
77
for _, v := range s {
88
if v != ' ' {
9-
result[i] = v
9+
ans[i] = v
1010
i++
1111
} else {
12-
result[i] = '%'
13-
result[i+1] = '2'
14-
result[i+2] = '0'
12+
ans[i], ans[i+1], ans[i+2] = '%', '2', '0'
1513
i += 3
1614
}
1715
}
18-
return string(result)[:i]
16+
return string(ans)[:i]
1917
}

0 commit comments

Comments
 (0)
Please sign in to comment.