Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/SuprDewd/CompetitiveProgramming
/ push
Method
push
code/data-structures/monotonic_queue.cpp:3–5 ·
view source on GitHub ↗
Source
from the content-addressed store, hash-verified
1
struct min_stack {
2
stack<int> S, M;
3
void push(int x) {
4
S.push(x);
5
M.push(M.empty() ? x : min(M.top(), x)); }
6
int top() { return S.top(); }
7
int mn() { return M.top(); }
8
void pop() { S.pop(); M.pop(); }
Callers
2
push
Method · 0.45
fix
Method · 0.45
Calls
2
empty
Method · 0.45
top
Method · 0.45
Tested by
no test coverage detected