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 > Dictionary Match Count > Editorial

Dictionary Match Count — Solution & Editorial

Back to the Problem

Aho–Corasick: build a trie of the patterns, add failure links (BFS), accumulate output counts along failure links, then scan T once following goto/fail transitions and summing terminal counts.

Complexity: O(total pattern length + |T|)

Watch out: Output links must be propagated along failure edges — otherwise a pattern that is a suffix of another is missed.