MCPcopy Create free account
hub / github.com/Ainevsia/Leetcode-Rust / pop

Method pop

155. Min Stack/src/main.rs:31–37  ·  view source on GitHub ↗
(&mut self)

Source from the content-addressed store, hash-verified

29 }
30
31 fn pop(&mut self) {
32 if let Some(x) = self.s.pop() {
33 if self.ms.last() == Some(&x) {
34 self.ms.pop();
35 }
36 }
37 }
38
39 fn top(&self) -> i32 {
40 self.s.last().copied().unwrap()

Callers 1

basicFunction · 0.45

Calls

no outgoing calls

Tested by 1

basicFunction · 0.36