Skip to content

Chapter 1, question 3 bugΒ #22

@alexsheehan

Description

@alexsheehan

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).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions