Shuffle the Array Problem

Shuffle the Array Problem — ExecCode School DSA Practice

Solve the Shuffle the Array problem on ExecCode. Free online school DSA practice in Arrays - Basics. Write and run code in Java, C++, Python — no signup required to run.

Problem description

Given an array nums of 2n elements, consisting of x1, ..., xn and y1, ..., yn, reorder it to x1, y1, x2, y2, ..., xn, yn. Your task is to understand the rule and print the correct answer. You are working on Shuffle the Array.

Examples

Input 3 6 2 5 1 3 4 7; Output 2 3 5 4 1 7. Input 4 8 1 2 3 4 5 6 7 8; Output 1 5 2 6 3 7 4 8

Constraints

1 <= n <= 10^5

Practice Shuffle the Array free on ExecCode. Browse DSA problems, topic map, and placement guides.