leetle

Daily challenge for 2026-10-23

661. Nearest Charging Station Proximity

You are given a strictly increasing, non-empty array of integers stations representing coordinates of EV charging stations along a highway, and an array of integers vehicles representing vehicle coordinates.

For each vehicle, determine the minimum distance to any charging station.

Return an array of integers representing these minimum distances in the same order as vehicles.

Constraints:
There are 1–2,000 station coordinates, sorted strictly increasingly, and 0–2,000 vehicle coordinates. All coordinates are integers from -1,000,000 to 1,000,000. Preserve vehicle order in the result.

Example:
Input: stations = [4, 9, 15], vehicles = [2, 7, 10, 20]
Output: [2, 2, 1, 5]

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