Problem minstack
User rogueee
Submission Time 2024-12-03 18:52:04
Score 0
Max Time N/A
Max Memory N/A

Compile Error

minstack.cpp: In function ‘void push(int)’:
minstack.cpp:2:2: error: ‘s’ was not declared in this scope
2 | s.push(x);
| ^
minstack.cpp: In function ‘void pop()’:
minstack.cpp:6:2: error: ‘s’ was not declared in this scope
6 | s.pop();
| ^
minstack.cpp: In function ‘int top()’:
minstack.cpp:10:9: error: ‘s’ was not declared in this scope
10 | return s.top();
| ^
minstack.cpp: In function ‘int getMin()’:
minstack.cpp:14:7: error: ‘stack’ is not a member of ‘std’
14 | std::stack<int> temp;
| ^~~~~
minstack.cpp:1:1: note: ‘std::stack’ is defined in header ‘<stack>’; did you forget to ‘#include <stack>’?
+++ |+#include <stack>
1 | void push(int x) {
minstack.cpp:14:13: error: expected primary-expression before ‘int’
14 | std::stack<int> temp;
| ^~~
minstack.cpp:15:11: error: ‘s’ was not declared in this scope