resize_preserving_order_with_repeated_cnt

Function resize_preserving_order_with_repeated_cnt 

Source
pub fn resize_preserving_order_with_repeated_cnt<T>(
    vec: &[T],
    new_len: usize,
) -> (Vec<T>, Vec<usize>)
where T: Clone,
Expand description

Resize the vec while preserving the order

returns the repeated cnt of each value

                [2  2][2  2][2  2][2  2]
[0, 1, 2, 3] -> [0, 0, 1, 1, 2, 2, 3 ,3]