ccagml / leetcode-extension

Solved LeetCode problem in VS Code added some new features
https://marketplace.visualstudio.com/items?itemName=ccagml.vscode-leetcode-problem-rating
MIT License
245 stars 26 forks source link

题目155,测试case出现`testcase has incorrect number of arguments (expected 2, got 1)` #302

Open 578223592 opened 4 months ago

578223592 commented 4 months ago

🐛 Bug Report(错误报告)

题目155,测试case出现: image 在网页上没问题

To Reproduce(重现)

语言:cpp 代码:


// 参考:https://leetcode.cn/problems/min-stack/solutions/242861/zui-yi-dong-yi-ge-zhan-tong-shi-bao-cun-dang-qian-/
// 额外保存包含当前元素的时候栈内最小元素即可
class MinStack
{
    class Node
    {
    private:
        /* data */
    public:
        int val, preMin;
    };

public:
    stack<Node> stk_;
    MinStack()
    {
    }

    void push(int val)
    {
        Node node;
        node.val = val;
        node.preMin = node.val;
        if (!stk_.empty())
        {
            node.preMin = min({stk_.top().preMin, node.preMin});
        }
        stk_.push(node);
    }

    void
    pop()
    {
        stk_.pop();
    }

    int top()
    {
        return stk_.top().val;
    }

    int getMin()
    {
        return stk_.top().preMin;
    }
};

Expected behavior(预期行为)

A clear and concise description of what you expected to happen.(对您期望发生的事情进行清晰简洁的描述。)

Extension Output(扩展输出)

Paste here the LeetCode extension log from output channel.(将输出通道中的 LeetCode 扩展日志粘贴到此处。)

Guidance: Press Ctrl+Shift+U, and toggle the channel to LeetCode.(按Ctrl+Shift+U,将频道切换到LeetCode。)

Your Environment

ccagml commented 4 months ago

看起来是155题目给的示例格式跟大部分题目不一样