X665: First Integer Larger Than

Given an array of integers, return the first element in the array that is larger than maxVal. Assume the array has only posivitive numbers. If no value in numbers is larger than maxVal, then return maxVal.

Examples:

largerThan({0,1,2,5},3) -> 5
largerThan({10,2,4},2) -> 10

Your Answer:

Reset

Practice a different Java exercise

Feedback

Your feedback will appear here when you check your answer.