You are given an array A of length N and an array B of length N-1.
You need to output array where items alternates:
A[0], B[0], A[1], B[1], ..., B[N-2], A[N-1]
Restrictions:
N>0
Type of items is not specified, but code should work at least for unsigned integers.
Sample input:
A = [1,2,3,4]
B = [7,8,9]
Sample output:
[1,7,2,8,3,9,4]
Edge case input:
A = ['Hello, world']
B = []
Edge case output:
['Hello, world']
This question is a simplified version of Zip uneven lists.
Nalways be at least 2? Please add test cases to cover those possibilities, if applicable \$\endgroup\$