<h2><a href="https://www.geeksforgeeks.org/problems/shuffle-integers2401/1">Shuffle integers</a></h2><h3>Difficulty Level : Medium</h3><hr><div class="problems_problem_content__Xm_eO"><p><span style="font-size: 18px;">Given an array <strong>arr</strong>&nbsp;of <strong>n </strong>elements in the following format {a<sub>1</sub>, a<sub>2</sub>, a<sub>3</sub>, a<sub>4</sub>, ... , a<sub>n/2</sub>, b<sub>1</sub>, b<sub>2</sub>, b<sub>3</sub>, b<sub>4</sub>, ... , b<sub>n/2</sub>}, the task is shuffle the array to {a<sub>1</sub>, b<sub>1</sub>, a<sub>2</sub>, b<sub>2</sub>, a<sub>3</sub>, b<sub>3</sub>, ... , a<sub>n/2</sub>, b<sub>n/2</sub>} without using extra space.<br>Note that n is <strong>even</strong>.</span></p>
<p><span style="font-size: 18px;"><strong>Example 1:</strong></span></p>
<pre><span style="font-size: 18px;"><strong>Input: <br></strong>n = 4, arr = {1, 2, 9, 15}
<strong>Output:</strong>  <br>1 9 2 15
<strong>Explanation</strong>: <br>a<sub>1</sub>=1, a<sub>2</sub>=2, b<sub>1</sub>=9, b<sub>2</sub>=15. So the final array will be: a<sub>1</sub>, b<sub>1</sub>, a<sub>2</sub>, b<sub>2</sub> = {1,9,2,15}.</span></pre>
<p><span style="font-size: 18px;"><strong style="font-family: sans-serif; white-space: normal;">Example 2:</strong><strong><br></strong></span></p>
<pre><span style="font-size: 18px;"><strong>Input:&nbsp;<br></strong></span><span style="font-size: 18px;">n = 6 arr = {1, 2, 3, 4, 5, 6} <br></span><span style="font-size: 18px;"><strong>Output:</strong>&nbsp;<br>1 4 2 5 3 6</span></pre>
<p><span style="font-size: 18px;"><strong>Your Task:</strong><br>This is a function problem. You don't need to take any input, as it is already accomplished by the driver code. You just need to complete the function <strong>shuffleArray() </strong>that takes array<strong> arr, </strong>and an integer<strong> n</strong>&nbsp;as parameters and modifies the given array according to the above-given pattern.</span></p>
<p><span style="font-size: 18px;"><strong>Expected Time Complexity:</strong> O(n).<br><strong>Expected Auxiliary Space:</strong> O(1).</span></p>
<p><span style="font-size: 18px;"><strong>Constraints:</strong><br>1 ≤ n ≤ 10<sup>5</sup><br></span><span style="font-size: 18px;">1 ≤ arr</span><sub>i </sub><span style="font-size: 18px;">≤ 10<sup>3</sup></span></p></div><p><span style=font-size:18px><strong>Company Tags : </strong><br><code>Amazon</code>&nbsp;<code>OYO Rooms</code>&nbsp;<br><p><span style=font-size:18px><strong>Topic Tags : </strong><br><code>Arrays</code>&nbsp;<code>Recursion</code>&nbsp;<code>Data Structures</code>&nbsp;<code>Algorithms</code>&nbsp;