fn insert_or_push(&mut self, value: u64) {
        self.position = 1 + (self.position + self.steps) % self.buffer.len();
        if self.position == 1 {
            self.buffer.insert(self.position, value);
        } else {
            self.buffer.push(value);
        }
    }
//
// Customized function for part 2: since we only care about
// values at position 1, we can push other values onto the end.
// For Vec, push() is much faster than insert().
//
Customized function for part 2: since we only care about
values at position 1, we can push other values onto the end.
For Vec, push() is much faster than insert().
Customized function for part 2 : since we only care about values at position 1 we can push other values onto the end . For Vec push () is much faster than insert () .
fn insert_or_push(&mut self, value: u64) {
        self.position = 1 + (self.position + self.steps) % self.buffer.len();
        if self.position == 1 {
            self.buffer.insert(self.position, value);
        } else {
            self.buffer.push(value);
        }
    }
fn insert_or_push ( & mut self , value : u64 ) { self . position = 1 + ( self . position + self . steps ) % self . buffer . len ( ) ; if self . position == 1 { self . buffer . insert ( self . position , value ) ; } else { self . buffer . push ( value ) ; } }
Customized function for part 2: since we only care about
values at position 1, we can push other values onto the end.
Customized function for part 2 : since we only care about values at position 1 we can push other values onto the end .
&mut self
value
u64