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

 

norm.krumpe@muohio.edu labweek11 > firstHalf
prev  |  next  |  chance

Given a non-empty array containing an even number of elements, return a new array consisting of the elements from the first half of the given array. For example, if the given array contains 6 elements, return a new array consisting of its first 3 elements.


firstHalf([4, 7, 1, 5, 4, 2]) → [4, 7, 1]
firstHalf([2, 8]) → [2]
firstHalf([1, 2, 2, 1]) → [1, 2]

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

int[] firstHalf(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