leetle

Daily challenge for 2025-03-06

65. Binary Search

Write a function solve that performs a binary search on a sorted list to find a target and return its index. If the target is not in the list, return -1. For true binary search, your algorithm should run in O(logn) time, but that is not actually a strict requirement for this problem.

Example:
Input: [1,2,4,5,7,9], 5
Output: 3

Run this challenge interactively in Python or JavaScript when the app loads.