Skip to content

Commit b42d9cd

Browse files
author
Kyle Liu
committed
update 05 solution
1 parent 9a4bf27 commit b42d9cd

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)