id/email
password
forgot password | create account
about | help | code help+videos | done | prefs
CodingBat code practice

 

norm.krumpe@muohio.edu arrays > mergeSortedArrays
prev  |  next  |  chance

The normal mergeSort algorithm splits an array into two halves and mergeSorts each half. Then, it takes those two sorted halves and merges them together. This focuses on the part of the algorithm that merges two already sorted arrays into one big array. Given two sorted arrays of ints, return an array that merges these two arrays together into one sorted array. Arrays need not be the same length, and either or both arrays could be empty.


mergeSortedArrays([1, 7], [2, 50]) → [1, 2, 7, 50]
mergeSortedArrays([10], [4, 7, 15, 99, 200]) → [4, 7, 10, 15, 99, 200]
mergeSortedArrays([27, 27], []) → [27, 27]

...Save, Compile, Run (ctrl-enter)

int[] mergeSortedArrays(int[] nums1, int[] nums2) { }

Editor font size %:
Shorter output


Forget It! -- delete my code for this problem

Progress graphs:
 Your progress graph for this problem
 Random user progress graph for this problem
 Random Epic Progress Graph

Java Help

Misc Code Practice

Difficulty: 200

Copyright Nick Parlante 2017 - privacy