Step:Start: Find the longest balanced subarray (equal count of odd and even numbers, counting each distinct value once) using a lazy segment tree over prefix balances.
0 / 36
nums=[1, 2, 3, 2, 1]
0 / 36
algomaster.io
Step:Start: Find the longest balanced subarray (equal count of odd and even numbers, counting each distinct value once) using a lazy segment tree over prefix balances.