Skip to content

Commit 59d11a4

Browse files
authored
Merge pull request kdn251#58 from emrecosar/master
Fixed compile error and some typo
2 parents bfec061 + aa37cb0 commit 59d11a4

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

CrackingTheCodingInterview/Chapter1ArraysAndStrings/ReplaceSpaces.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
// Write a method to replace all spaces in a string with '%20.' You may assum ethat the string
2-
// has sufficient space at th eend of the string to hold the additional characters, and that you
1+
// Write a method to replace all spaces in a string with '%20.' You may assume that the string
2+
// has sufficient space at the end of the string to hold the additional characters, and that you
33
// are given the "true" length of the string. (Note: if implementing in Java, please use a characters
44
// array so that you can perform this operation in place)
55

66
public class ReplaceSpaces {
77
public void replaceSpaces(char[] str, int length) {
8-
int spaceCount = 0, newLength; i;
8+
int spaceCount = 0, newLength;
99
for(int i = 0; i < length; i++) {
1010
if(str[i] == ' ') {
1111
spaceCount++;

0 commit comments

Comments
 (0)