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

 

orion.a.smith@gmail.com apcsa-arrays > apcsaArraysSwitchJoiner
prev  |  next  |  chance

Given two arrays of ints called numsA and numsB, one of the arrays will have values that are guaranteed (this is a precondition) to be less than all of the values in the other array. Find which array has the lesser values, then create and return an array containing all of the lesser-input elements (in the same order they were presented in the input array), followed by all the greater-input elements (again, in the same order). Other precondition: numsA and numsB will each have at least one element. Note that numsA and numsB do not have to be sorted for this algorithm to work!


apcsaArraysSwitchJoiner([0, 1], [4, 3]) → [0, 1, 4, 3]
apcsaArraysSwitchJoiner([15, 18, 19], [3, -1]) → [3, -1, 15, 18, 19]
apcsaArraysSwitchJoiner([2, 3, 4], [5, 6, 7]) → [2, 3, 4, 5, 6, 7]

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

public int[] apcsaArraysSwitchJoiner(int[] numsA, int[] numsB) { }

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: 240

Copyright Nick Parlante 2017 - privacy