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

 

list_interleave


Given two lists named "a" and "b", interleave them together into a new list, so that the new list stores the first value from "a", then the first from "b", then the second from "a", then the second from "b", etc. If one of the lists runs out of numbers, copy all of the rest of them onto the end of the new list before returning it.


list_interleave([1, 2, 3], [4, 5, 6]) → [1, 4, 2, 5, 3, 6]
list_interleave([1, 2], [3, 4, 5]) → [1, 3, 2, 4, 5]
list_interleave([1, 2, 3], [4, 5]) → [1, 4, 2, 5, 3]

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

public List<Integer> list_interleave(List<Integer> a, List<Integer> b) { }

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

Post-solution available

Copyright Nick Parlante 2017 - privacy