pub fn validate_permutation(perm: &[usize], n: usize) -> Result<(), SparseError>Expand description
Validate that perm is a valid permutation of 0..n.
Returns Ok(()) if perm has exactly n elements and is a bijection on 0..n.
ยงErrors
perm.len() != n- Any element is out of bounds (
>= n) - Any element appears more than once