pub fn increasing_array(array: Vec<u64>) -> u64 {
    let mut moves = 0;
    let mut iter = array.iter();
    // Start with an accumulator = array[0]
    let mut accumulator = iter.next().unwrap(); // FIXME: remove unwrap

    // Iterate through the rest of the array
    while let Some(number) = iter.next() {
        // If the number is equal to the accumulator, continue
        if number == accumulator {
            continue;
        }
        // If the number is larger than the current accumulator, make accumulator = number and continue
        if number > accumulator {
            accumulator = number;
            continue;
        }
        // If the number is smaller than the current accumulator, increment until it is at least as large as the accumulator. Keep the accumulator, as they're now equal.
        moves += accumulator - number;
    }

    moves
}
/// Returns the minimum number of "moves" required in order to make the array monotonically increasing in order, where a "move" is an operation of incrementing any single element by one.
Returns the minimum number of "moves" required in order to make the array monotonically increasing in order, where a "move" is an operation of incrementing any single element by one.
Returns the minimum number of " moves " required in order to make the array monotonically increasing in order where a " move " is an operation of incrementing any single element by one .
pub fn increasing_array(array: Vec<u64>) -> u64 {
    let mut moves = 0;
    let mut iter = array.iter();
    // Start with an accumulator = array[0]
    let mut accumulator = iter.next().unwrap(); // FIXME: remove unwrap
    // Iterate through the rest of the array
    while let Some(number) = iter.next() {
        // If the number is equal to the accumulator, continue
        if number == accumulator {
            continue;
        }
        // If the number is larger than the current accumulator, make accumulator = number and continue
        if number > accumulator {
            accumulator = number;
            continue;
        }
        // If the number is smaller than the current accumulator, increment until it is at least as large as the accumulator. Keep the accumulator, as they're now equal.
        moves += accumulator - number;
    }
    moves
}
pub fn increasing_array ( array : Vec < u64 > ) -> u64 { let mut moves = 0 ; let mut iter = array . iter ( ) ; // Start with an accumulator = array[0] let mut accumulator = iter . next ( ) . unwrap ( ) ; // FIXME: remove unwrap // Iterate through the rest of the array while let Some ( number ) = iter . next ( ) { // If the number is equal to the accumulator, continue if number == accumulator { continue ; } // If the number is larger than the current accumulator, make accumulator = number and continue if number > accumulator { accumulator = number ; continue ; } // If the number is smaller than the current accumulator, increment until it is at least as large as the accumulator. Keep the accumulator, as they're now equal. moves += accumulator - number ; } moves }
Returns the minimum number of "moves" required in order to make the array monotonically increasing in order, where a "move" is an operation of incrementing any single element by one.
Returns the minimum number of " moves " required in order to make the array monotonically increasing in order where a " move " is an operation of incrementing any single element by one .
array
Vec<u64>