Skip to content

Bug Report for minimum-stack #4887

@Anfebule

Description

@Anfebule

Bug Report for https://neetcode.io/problems/minimum-stack

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

Hi again! Here's my implementation of the MinStack class:

private final List<Integer> stackList;

    public MinStack() {
        stackList = new ArrayList<>();
    }

    public void push(int val) {
        stackList.add(val);
    }

    public void pop() {
        stackList.remove(stackList.size() - 1);
    }

    public int top() {
        return stackList.get(stackList.size() - 1);
    }

    public int getMin() {
        return stackList.get(0);
    }

The result from an external IDE, following the same steps described in the test case, is as follows:
[1,2,1]

And from your IDE is as follows:
[0,2,1]

I don't know how your validator works, but it seems it's not validating correctly.

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