Question: Two questions, 1) how do I do this, 2) what is wrong with my code norm krumpe@muohio.edu program11 even Positions prev I next chance Given
Two questions, 1) how do I do this, 2) what is wrong with my code norm krumpe@muohio.edu program11 even Positions prev I next chance Given an array of integer values, return a new array consisting only of the elements that have even- numbered indexes. even Positions([7, 51) [7] even Positions([8, 1, 7, 4, 6, 10, 5]) [8, 7, 6, 51 evenPositions([13]) [13] Save, Compile, Run Go int[1 even Positions(int[] nums) int[] newArrays new int[nums. length/2]; for (int i 0; iknums.length; it 2){ new Array[i] nums[ij;l if (nums. length 2- 1) newArray new int[ nums. length +1)/2] for (int i e; i nums. length; i+ 2){ newArray[i] nums [i]; return newArray
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
