Menu
Coddy logo textTech

Alternating

Lesson 15 of 20 in Coddy's Beginner Challenges - Practice Basic Concepts course.

challenge icon

Challenge

Easy

Write a function named alternate that gets two arrays of integers and returns an array that is a combination of the arrays alternating.

Example,

  • alternate([1, 2, 3], [4, 5, 6])  ->  [1, 4, 2, 5, 3, 6]

Assume that the arrays are of the same length

Try it yourself

int* alternate(int* a1, int a1Size, int* a2, int a2Size, int* returnSize) {
    // Write code here
}

All lessons in Beginner Challenges - Practice Basic Concepts