Citi Interview Question

Question based on pattern matching.