id/email
password
forgot password | create account
about | help | code help+videos | done | prefs
CodingBat code practice

 

norm.krumpe@muohio.edu arrays > swapHalves
prev  |  next  |  chance

Given an array containing an even number of elements, return a new array with the two halves of the array swapped.


swapHalves([1, 2, 3, 4, 5, 6]) → [4, 5, 6, 1, 2, 3]
swapHalves([2, 1, 18, 4]) → [18, 4, 2, 1]
swapHalves([4, 9]) → [9, 4]

...Save, Compile, Run (ctrl-enter)

public int[] swapHalves(int[] nums) { }

Editor font size %:
Shorter output


Forget It! -- delete my code for this problem

Progress graphs:
 Your progress graph for this problem
 Random user progress graph for this problem
 Random Epic Progress Graph

Java Help

Misc Code Practice

Difficulty: 200

Copyright Nick Parlante 2017 - privacy