Skip to content

Commit

Permalink
Merge pull request kdn251#58 from emrecosar/master
Browse files Browse the repository at this point in the history
Fixed compile error and some typo
  • Loading branch information
kdn251 authored Feb 2, 2018
2 parents bfec061 + aa37cb0 commit 59d11a4
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
// Write a method to replace all spaces in a string with '%20.' You may assum ethat the string
// has sufficient space at th eend of the string to hold the additional characters, and that you
// Write a method to replace all spaces in a string with '%20.' You may assume that the string
// has sufficient space at the end of the string to hold the additional characters, and that you
// are given the "true" length of the string. (Note: if implementing in Java, please use a characters
// array so that you can perform this operation in place)

public class ReplaceSpaces {
public void replaceSpaces(char[] str, int length) {
int spaceCount = 0, newLength; i;
int spaceCount = 0, newLength;
for(int i = 0; i < length; i++) {
if(str[i] == ' ') {
spaceCount++;
Expand Down

0 comments on commit 59d11a4

Please sign in to comment.