fn pop_n(&mut self, n: usize) -> bool {
        if self.stack.len() < n {
            panic!("invalid state");
        }
        let head = self.stack.pop().unwrap();
        self.stack.truncate(self.stack.len() - (n - 1)); // pop n-1 times efficiently
        head
    }
/// Pops n times and returns the first popped element
Pops n times and returns the first popped element
Pops n times and returns the first popped element
fn pop_n(&mut self, n: usize) -> bool {
        if self.stack.len() < n {
            panic!("invalid state");
        }
        let head = self.stack.pop().unwrap();
        self.stack.truncate(self.stack.len() - (n - 1)); // pop n-1 times efficiently
        head
    }
fn pop_n ( & mut self , n : usize ) -> bool { if self . stack . len ( ) < n { panic ! ( " " ) ; } let head = self . stack . pop ( ) . unwrap ( ) ; self . stack . truncate ( self . stack . len ( ) - ( n - 1 ) ) ; // pop n-1 times efficiently head }
Pops n times and returns the first popped element
Pops n times and returns the first popped element
&mut self
n
usize
&mut self
n
usize