Search
⌘K
Leetcode 3686. Number of Stable Subsequences
Count the number of subsequences of nums that do not contain three consecutive elements of the same parity, returning the result modulo 1e9+7. With n up to 1e5, this is typically solved by dynamic programming/state-tracking that remembers the last one or two parities to avoid forming parity triples.
Asked at:
Meta
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
All Regions
Mid February, 2026
Meta
Mid-level
Lenskart
Comments
Hello Interview Premium
Your account is free and you can post anonymously if you choose.