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

 

simona1@sfusd.edu arrays2 > firstTwo
prev  |  next  |  chance

Given an array of integers of length 2 or greater, return a new array of length 2 that contains the first two elements.


firstTwo([1, 2, 1, 1]) → [1, 2]
firstTwo([11, -2, 1]) → [11, -2]
firstTwo([5, 4, 3, 2, 1]) → [5, 4]

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

public int[] firstTwo(int[] aRay){ }

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

Copyright Nick Parlante 2017 - privacy