root@coding-prodigies:~#
← All challenges

Merge Two Sorted Arrays

Combine two already-sorted arrays into one sorted array.

🟠 HardDifficulty

The challenge

Given the sorted arrays [1, 3, 5, 7] and [2, 4, 6, 8], print a single space-separated array containing all 8 numbers in sorted order.

Output

  
🧠 Need a hint? (Python)

Since both inputs are already sorted, combining them (a + b) and calling sorted() on the result gets the right answer in one line, even if it's not the most efficient possible approach.

🚀

Like solving these?

Structured courses, hands-on exercises, and real multi-file projects are waiting -- your first project unlock is free.

Create a free account

More challenges