Skip to content

Bug Report for dynamicArray #5773

@ashishsantikari

Description

@ashishsantikari

Bug Report for https://neetcode.io/problems/dynamicArray

Issue: Instructions mismatch, it requires more context, what does end of array mean?

Instruction in the question:

void pushback(int n) will push the element n to the end of the array.

Solution for the question

# Insert n in the last position of the array
    def pushback(self, n: int) -> None:
        if self.length == self.capacity:
            self.resize()
            
        # insert at next empty position
        self.arr[self.length] = n
        self.length += 1

Please describe the bug below and include any steps to reproduce the bug or screenshots if possible.

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