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

Java > Array-1 > midThree
prev  |  next  |  chance

Given an array of ints of odd length, return a new array length 3 containing the elements from the middle of the array. The array length will be at least 3.

midThree({1, 2, 3, 4, 5}) → {2, 3, 4}
midThree({8, 6, 7, 5, 3, 0, 9}) → {7, 5, 3}
midThree({1, 2, 3}) → {1, 2, 3}

...Save, Compile, Run

See also Java Example Code. Java help docs: If Boolean Logic | Strings | While and For Loops | Arrays and Loops


prev  |  next  |  chance   |  CodingBat  >  Array-1

Forget It! -- delete my code for this problem 166.0

Copyright Nick Parlante 2006-10 - privacy