Problem 3719 · Medium

Longest Balanced Subarray I

A subarray is balanced when it has the same number of distinct even values and distinct odd values. Find the longest balanced subarray.

Open the interactive visualisation