Function malachite_base::slices::slice_leading_zeros
source · [−]Expand description
Counts the number of zeros that a slice starts with.
Worst-case complexity
$T(n) = O(n)$
$M(n) = O(1)$
where $T$ is time, $M$ is additional memory, and $n$ is xs.len()
.
Examples
use malachite_base::slices::slice_leading_zeros;
assert_eq!(slice_leading_zeros::<u32>(&[1, 2, 3]), 0);
assert_eq!(slice_leading_zeros::<u32>(&[0, 0, 0, 1, 2, 3]), 3);