Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/Ainevsia/Leetcode-Rust
/ push
Method
push
155. Min Stack/src/main.rs:24–29 ·
view source on GitHub ↗
(&mut self, x: i32)
Source
from the content-addressed store, hash-verified
22
}
23
24
fn push(&mut self, x: i32) {
25
self.s.push(x);
26
if self.ms.is_empty() || self.ms.last().unwrap() >= &x {
27
self.ms.push(x);
28
}
29
}
30
31
fn pop(&mut self) {
32
if let Some(x) = self.s.pop() {
Callers
2
three_sum
Method · 0.45
basic
Function · 0.45
Calls
no outgoing calls
Tested by
1
basic
Function · 0.36