{"id":"streaming-counter-reset-pattern","text":"The \"streaming counter with reset\" idiom — increment on match, reset to 0 on mismatch — is used to detect k consecutive elements satisfying a predicate in O(n) time and O(1) space; `threeConsecutiveOdds` uses it with k=3.","truth_value":"IN","source":"entries/2026/06/06/three-consecutive-odds-solution.md","source_url":"","source_hash":"","justifications":[],"dependents":[],"metadata":{},"created_at":"","updated_at":"","reviewed_at":"","verified_at":"","retracted_at":"","explanation":{"steps":[{"node":"streaming-counter-reset-pattern","truth_value":"IN","reason":"premise"}]}}