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
If you assign a value to an index greater than the length of the string, the string doesn't increase in size like an array does (I assume this is why in the book it says 'If implementing in Java, please use a character array so that you can perform this operation in place.'). The tests pass because the string is being converted to an array to test it: expect(func(arg.split(''))).to.eql(expected);
I haven't been able to find a way to expand a string's length in place in JavaScript, so I'm not sure it's possible to do in O(1) space (specifically in JS).
The text was updated successfully, but these errors were encountered:
If you assign a value to an index greater than the length of the string, the string doesn't increase in size like an array does (I assume this is why in the book it says 'If implementing in Java, please use a character array so that you can perform this operation in place.'). The tests pass because the string is being converted to an array to test it:
expect(func(arg.split(''))).to.eql(expected);
I haven't been able to find a way to expand a string's length in place in JavaScript, so I'm not sure it's possible to do in O(1) space (specifically in JS).
The text was updated successfully, but these errors were encountered: