(int[] nums, int n)
| 1 | class Solution { |
| 2 | public int[] shuffle(int[] nums, int n) { |
| 3 | int [] result = new int[2 * n]; |
| 4 | |
| 5 | // Looping over the array |
| 6 | for(int i = 0; i < 2 * n; i ++){ |
| 7 | // If the array index is even |
| 8 | if(i % 2 == 0) |
| 9 | result[i] = nums[i / 2]; |
| 10 | |
| 11 | // If it's not even, its odd |
| 12 | else |
| 13 | result[i] = nums[n + i / 2]; |
| 14 | } |
| 15 | |
| 16 | return result; |
| 17 | } |
| 18 | } |
nothing calls this directly
no outgoing calls
no test coverage detected