leetle

Daily challenge for 2026-06-11

527. Minimum Difference of Extremes

Given a sorted array of integers nums, find the minimum difference between the largest and smallest elements of any contiguous subarray of length exactly 3. If the array has fewer than 3 elements, return 0.

Example:
Input: nums = [1, 5, 8, 10, 15]
Output: 5
(Explanation: The subarrays of length 3 are [1,5,8] diff 7, [5,8,10] diff 5, and [8,10,15] diff 7. The minimum difference is 5.)

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