Counting Sort 1

  • + 0 comments

    A rust solution:

    fn countingSort(arr: &[i32]) -> Vec<i32> {
        arr.iter()
            .fold(vec![0; 100], |mut acc, &x| {
                acc[x as usize] += 1;
                acc
            })
    }