Code
Hub
Workspaces
Connect
Indexed graphs
Engine
MCP
copy
hub
/
github.com/qiyuangong/leetcode
/ push
Method
push
java/155_Min_Stack.java:44–48 ·
view source on GitHub ↗
(int x)
Source
from the content-addressed store, hash-verified
42
}
43
44
public
void
push(
int
x) {
45
stack.push(x);
46
if
(minStack.size() == 0 || x <= minStack.peek()) minStack.push(x);
47
else
minStack.push(minStack.peek());
48
}
49
50
public
void
pop() {
51
stack.pop();
Callers
nothing calls this directly
Calls
1
peek
Method · 0.45
Tested by
no test coverage detected