Menu
Coddy logo textTech

Final Challenge #1

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

challenge icon

Challenge

Easy

Time to put a twist on Merge Sort.

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

Hint: the only real change is inside the merge step, where you decide which front element to take first.

Try it yourself

#include <stdlib.h>

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

All lessons in Merge Sort - DSA Series