Tag Info

New answers tagged

0

the spaceCount loop counts all of the actual spaces in the string, and ignores the spaces at the end (since you've been given the actual length of the string minus the trailing space in the length parameter). The spec doesn't say that the amount of space left at the end of the string coincides exactly with the required space to hold the additional ...


1

The definition you posted says: You may assume that the string has sufficient space at the end of the string to hold the additional characters. And not: You may assume that the string has exactly enough space at the end of the string to hold the additional characters. Lesson 1 in code interviewing is to read (or listen to) the specification ...



Top 50 recent answers are included