leetle

Daily challenge for 2026-09-18

626. Floor Level Elevator Dispatch

You are controlling a smart elevator in a high-rise tower. The elevator has a list of distinct floor numbers sorted in increasing order floors where passengers have requested service, and a current floor target.

Using binary search, find and return the exact index in floors that matches target. If target is not among the requested floors, return the index where it would be inserted to keep the list strictly sorted.

Example:
Input: floors = [2, 5, 8, 12, 16], target = 8
Output: 2

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