CJCoding With Joseph

Merge Two Sorted Arrays

Two already-sorted arrays a = {1, 3, 5, 7} and b = {2, 4, 6, 8} are given. Merge them into one sorted array and print it on a single line separated by single spaces:

1 2 3 4 5 6 7 8

Use the two-pointer merge technique: repeatedly take the smaller front element from a or b. Do not just sort a concatenation.

Expected Output:

1 2 3 4 5 6 7 8
Topics:
Arrays
Code Editor
1
Tab to indent ยท Ctrl+Enter to run ยท Ctrl+Space to expand shortcuts (sysout, psvm, fori)

Your Output

Run your code to see the output here...

Test Cases

Run your code to see test case results.