Menu
Coddy logo textTech

Merge Two Sorted Lists

Lesson 4 of 15 in Coddy's Recursion Challenges - Master The Recursive Thinking course.

challenge icon

Challenge

Easy

Write a function named merge that gets two sorted arrays of integers and returns a merged array of the two, sorted.

Examples:

  • [1,5,7], [2, 6, 9] -> [1, 2, 5, 6, 7, 9]
  • [-1, 5], [0, 9] -> [-1, 0, 5, 9]

Try it yourself

#include <stdlib.h>

int* merge(int* a1, int a1_size, int* a2, int a2_size, int* returnSize) {
    // Write code here
    *returnSize = 0;
    return NULL;
}

All lessons in Recursion Challenges - Master The Recursive Thinking