X1360: Binary Search Char (non-recursive)

Complete the following binary search method on characters. Find the character search in the array letters. Return the index of the element if found, -1 if the letter is not found. You may assume the array is properly ordered.

Examples:

binarySearch({'a','c','e'},'e') -> 2
binarySearch({'b','d','d','f','z'},'d') -> 2

Your Answer:

Reset

Practice a different Java exercise

Feedback

Your feedback will appear here when you check your answer.