X439: Binary Search (non-recursive)

Complete the following binary search method. Find the number num in the array array. Return -1 if the number is not found. You may assume the array is properly ordered.

Examples:

binarySearch({1,4,7},7) -> 2
binarySearch({2,6,6,8,80},6) -> 2

Your Answer:

Reset

Practice a different Java exercise

Feedback

Your feedback will appear here when you check your answer.