pub fn delete_nth_naive(
list: &[i32],
max_occurence: usize,
) -> Result<Vec<i32>, String>Expand description
Returns a list where no more than n occurence can be in the output, naive version.
Takes a list reference as input and a maximum occurence then returns a Vec<i32> or an error
explaining the problem.
ยงExamples
Basic usage:
let result = algorithmz::array::delete_nth_naive(&[3, 5, 2, 3, 1, 4, 3, 6, 4, 4],2).unwrap();
assert_eq!(result,[3, 5, 2, 3, 1, 4, 6, 4]);Match example:
use algorithmz::array::delete_nth_naive;
match delete_nth_naive(&[3, 5, 2, 3, 1, 4, 3, 6, 4, 4],2) {
Ok(n) => println!("The result was: {:?}",n),
Err(e) => eprintln!("The error was: {}",e),
}