X101: pre4

Given a non-empty array of type int, return a new array containing the elements from the original array that came before thefirst 4 in the original array. The original array will contain at the least one 4. Note that it is valid in Java to create an array of length 0.

Your Answer:

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

Feedback

Your feedback will appear here when you check your answer.