Skip to content

Bug Report for insert-new-interval #5629

@eyelesscactus54

Description

@eyelesscactus54

Bug Report for https://neetcode.io/problems/insert-new-interval

Image

The recommended space complexity is O(1), which is possible if the intervals list supports adding new elements without (necessarily) resizing. But C# arrays are fixed-size. So since it's possible that an interval will be added to the list, we can't guarantee that all intervals will fit within the original size. Rather, a new array might have to be created with n+1 size.

I suggest that the recommended space be changed to O(n).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions