neetcode-gh/leetcode

Bug Report for minimum-stack

Opened this issue · 1 comments

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.

Can you share the entire code?