Problem 3101 · Medium
Count alternating subarrays by keeping the length of the alternating run that ends at each index.
Open the interactive visualisation