Problem 3737 · Medium

Count Subarrays With Majority Element I

Map each value to +1 when it equals the target and -1 otherwise, then count subarrays whose sum is positive.

Open the interactive visualisation