Đề bài đậy ạ. Cảm ơn mọi người :)

PROBLEM

Write a recursive function that does the following:
Input: An array A of length N. N is an even number and N >= 2.

Output: A reordered array B. The first half of B contains A’s elements with even indices. The second half of B contains A’s elements with odd indices. Convention: the first index of an array is 0 (and thus it is an even number).

Input 1: [4, 8, 12, 16]

For this array, the indices and the values are as follows:

[IMG]

Thus, the output is as follows:

Expected output 1: [4, 12, 8, 16]

ADDITIONAL TEST CASE

Input 2: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
Expected output 2: [1, 3, 5, 7, 9, 2, 4, 6, 8, 10]

TASK

Write a recursive function in a programming language of your choice (as if you are writing real code to be used on a production server) for the above problem
In addition to the main function, you are free to write helper functions (if needed)

The code should have as few lines as possible (but it should still be clear and readable)