Capital One logoCapital One
Coding·70 minMembers

Sawtooth (Alternating Parity) Subarray Count

Members only

Count contiguous subarrays whose elements alternate parity (even-odd-even-... or odd-even-odd-...). Single-element subarrays always count. A brute-force O(n²) solution times out on the hidden tests.

SWE
MLE
array
sliding-window
medium
oa
codesignal
Frequency
Low
Last asked
2026-01-19
Stage
oa

Log in to continue reading the full content