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

 

alternate


Combine two arrays into a new array, with each element alternating in the new array, starting with the first element of the first array.


alternate(["a", "yes", "no", "maybe", "ok"], ["one", "two", "three", "four"]) → ["a", "one", "yes", "two", "no", "three", "maybe", "four", "ok"]
alternate(["A", "B", "C", "D", "E"], ["1", "2", "3", "4", "5"]) → ["A", "1", "B", "2", "C", "3", "D", "4", "E", "5"]
alternate(["q", "w", "e", "r", "t", "y", "u", "i", "o", "p"], ["key", "board", "letters", "numbers", "words", "typing", "asdf", "keyboard", "ghjkl"]) → ["q", "key", "w", "board", "e", "letters", "r", "numbers", "t", "words", "y", "typing", "u", "asdf", "i", "keyboard", "o", "ghjkl", "p"]

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

public String[] alternate(String[] arr1, String[] arr2) { }

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