Menu
Coddy logo textTech

Final Challenge #1

Lesson 8 of 9 in Coddy's Selection Sort - DSA Series course.

challenge icon

Challenge

Easy

Time to put a twist on Selection Sort.

Modify your selectionSort function so it sorts the array in descending order (from largest to smallest) and returns it.

Hint: instead of selecting the smallest element on each pass, select the largest one.

Try it yourself

#include <stdlib.h>

int* selectionSort(int* arr, int arr_size, int* returnSize) {
    // Write code here
    *returnSize = arr_size;
    return arr;
}

All lessons in Selection Sort - DSA Series