leetle

Daily challenge for 2026-08-12

589. Microchip Frequency Tuning

You are designing a microchip that needs to operate at a specific target frequency. You are given a sorted array of available stable frequencies. Your task is to find the frequency from the array that is closest to the target frequency. If there is a tie (two frequencies are equally close to the target), return the smaller frequency.

Your solution must run in O(log n) time complexity.

Example:
Input: frequencies = [10, 20, 30, 40, 50], target = 25
Output: 20

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