Menu
CoddyTech

Abschließende Herausforderung #2

Lektion 9 von 9 im Kurs Counting Sort – DSA-Reihe von Coddy.

challenge icon

Aufgabe

Mittel

Eine weitere Herausforderung.

Schreibe countingSort so, dass es das Array in aufsteigender Reihenfolge sortiert und Duplikate entfernt zurückgibt, sodass jeder Wert genau einmal vorkommt.

Zum Beispiel wird [3, 1, 2, 3, 1] zu [1, 2, 3].

Probier es selbst

#include <stdlib.h>

int* countingSort(int* arr, int arr_size, int* returnSize) {
    // Code hier schreiben
    *returnSize = arr_size;
    return arr;
}

Alle Lektionen in Counting Sort – DSA-Reihe

Übe selbstständig: Online-C-Compiler