Problem minstack
User Elwinthenerd
Submission Time 2024-11-08 15:48:39
Score 0
Max Time N/A
Max Memory N/A

Compile Error

minstack.cpp: In function ‘void push(int)’:
minstack.cpp:5:5: error: reference to ‘stack’ is ambiguous
5 | stack.push(x);
| ^~~~~
In file included from /usr/include/c++/9/stack:61,
from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:89,
from minstack.cpp:1:
/usr/include/c++/9/bits/stl_stack.h:99:11: note: candidates are: ‘template<class _Tp, class _Sequence> class std::stack’
99 | class stack
| ^~~~~
minstack.cpp:3:12: note: ‘std::stack<int> stack’
3 | stack<int> stack, minStack;
| ^~~~~
minstack.cpp: In function ‘void pop()’:
minstack.cpp:9:9: error: reference to ‘stack’ is ambiguous
9 | if (stack.top() == minStack.top()) minStack.pop();
| ^~~~~
In file included from /usr/include/c++/9/stack:61,
from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:89,