Count Subarrays With Alternating Parity (Odd/Even) Including Negatives
Given an integer array nums (may contain negative numbers), count how many contiguous subarrays have strictly alternating parity between adjacent elements.
Formally, a subarray nums[l..r] is ...
Example
Unlock to view complete problem details
and practice with sample input/output
Was this article helpful?
View Test Cases & Run Code requires membership
Standard Input
Execution Result:
