← Google questions

Count ternary strings without consecutive zeros and three consecutive ones

Filed under Google

Given an integer n, find the number of valid ternary strings of length n (using characters '0', '1', '2') such that no two consecutive '0's appear and no three consecutive '1's appear together.

You've read your 3 free write-ups

Sign up free to keep reading. Your account opens the first 10 questions of every company.

Related Google questions

Collected from public candidate posts and coding forums. Updated Nov 2026.