Given a sorted array of integers (which may include duplicates) and a target value, implement a function to perform a binary search. If the target is present, return the index of its first occurrence. If the target is absent, return the index of the closest element that does not exceed the target.
Ask AI Assistant

Ask AI Assistant
Ask me anything about this coding question!
Test Cases
Input
Output
Expected