Hiring process8 levels
  1. 1 IQ Test
  2. 2 Additional Online Test (If Required)
  3. 3 Office Interview with Hiring Manager
  4. 4 Unpaid Test Task (Motivation Check)
  5. 5 Paid Test Task and Follow-Up Interview
  6. 6 Iterative Paid Test Tasks
  7. 7 Office Verification
  8. 8 Final Interview with the Founder

Problems > Avoid 11 and 000 > Editorial

Avoid 11 and 000 — Solution & Editorial

Back to the Problem

Build the Aho–Corasick automaton of the forbidden set; delete terminal (matched) states. The transfer matrix over surviving states, raised to the N-th power, counts safe strings.

Complexity: O(states3 log N)

Watch out: A state is dead if it or any of its failure-link ancestors is terminal — propagate the terminal flag along fail links.