Pregunta de entrevista de Meta

General algorithm involving list merging, string pattern, math functions.