← ALL NOTES
Array

3721. Longest Balanced Subarray II

Like "Longest Balanced Subarray I," but for large n: a subarray is balanced if the number of distinct even values equals the number of distinct odd values. Find the maximum length, efficiently.

Loading…