X42: frontPiece

Given an int array of any length, return a new array of its first 2 elements. If the array is smaller than length 2, use whatever elements are present.

Your Answer:

x
 
1
public int[] frontPiece(int[] nums)
2
{
3
    
4
}
5
Reset

Practice a different Java exercise

Feedback

Your feedback will appear here when you check your answer.