X464: Arrays - Find the Last Number

Return the index of the last occurrence of a given number in an array. Return -1 if the number is not in the array.

Examples:

findTheLastNumber({3,3,4,4},4) -> 3
findTheLastNumber({3,3,4,4},5) -> -1
findTheLastNumber({3,3,3,3},3) -> 3

Your Answer:

Reset

Practice a different Java exercise

Feedback

Your feedback will appear here when you check your answer.