LeetCode 3719: Longest Balanced Subarray I — Solution Guide
Problem recap You’re given an integer array nums. A subarray is balanced if: Your task is to return the maximum length of any balanced subarray. A key detail: distinct matters. For example, in [3, 2, 2, 5, 4], the distinct even numbers are {2, 4} (count = 2), not 3. Constraints (important for choosing the … Read more