gudii9
asked on
makeMiddle Challenge
Hi,
I am working on below challenge and wrote as below
http://codingbat.com/prob/p199519
i passed all tests. How to improve my code, laternate ways of doing it effectively. please advise
I am working on below challenge and wrote as below
http://codingbat.com/prob/p199519
public int[] makeMiddle(int[] nums) {
int len=nums.length;
int[] numsNew=new int[2];
numsNew[0]=nums[(len/2)-1];
numsNew[1]=nums[(len/2)];
return numsNew;
}
i passed all tests. How to improve my code, laternate ways of doing it effectively. please advise
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.