Search
⌘K

Leetcode 3152. Special Array II

For each query, determine whether the subarray's adjacent elements strictly alternate parity (no two consecutive numbers share the same parity). With up to 1e5 elements and queries, the core challenge is to preprocess adjacent same-parity markers so each query can be answered in O(1) by checking if any same-parity adjacent pair exists in the range.


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Comments

Your account is free and you can post anonymously if you choose.