You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
at line 27: int extendedLen = len + 2 * numOfSpaces;
I do not really understand why we should time 2 to the numOfSpaces? why not times 3? Cause length of space =1, and length of %20=3
The text was updated successfully, but these errors were encountered:
It is because we replace 1-char spaces with 3-chars sequences, in other words we need additionally 2 chars for each space.
Assume we have N spaces, they occupy N chars.
We need 3 * N chars in sum for N of "%20". But we have N chars already that will be free if we remove spaces, thus we need additional 3 * N - N chars , that is equal to 2 * N.
at line 27: int extendedLen = len + 2 * numOfSpaces;
I do not really understand why we should time 2 to the numOfSpaces? why not times 3? Cause length of space =1, and length of %20=3
The text was updated successfully, but these errors were encountered: