Skip to content

Bug Report for minimum-stack #3996

Open
@tuanpnguyen

Description

@tuanpnguyen

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.?title=Bug Report for evaluate-reverse-polish-notation

This is not working (1)

public void pop() {
    if(stack.empty()) {
        return;
    }
   int top = stack.peek();
    if (stack.peek() == min.peek()) {
        min.pop();
    }
    stack.pop();


}

This is working

public void pop() {
    if(stack.empty()) {
        return;
    }
   int top = stack.peek();
    if (top == min.peek()) {
        min.pop();
    }
    stack.pop();


}

This may not be a bug but as I think the two function should return the same result. Can you check? As always, thanks and appreciate all the works of you and your team.

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