Daily challenge for 2026-04-20
475. Maximize Distinct Elements Window
Given an array of integers nums and an integer k, find the maximum number of distinct elements present in any contiguous subarray of length exactly k.
Example:Input: nums = [1, 2, 1, 3, 4, 2, 3], k = 4Output: 4
Explanation: The subarray [1, 3, 4, 2] has 4 distinct elements.
Run this challenge interactively in Python or JavaScript when the app loads.