#3101

Count Alternating Subarrays

specialist · 760 · lc medium +31 · 57.3% accepted · 242 likes · top 53%

Description

Given a binary array nums, a subarray is alternating when every pair of adjacent elements within it has different values. Return the total number of alternating subarrays.

Code

1
2
3