Pregunta de entrevista de Bloomberg

the brain teaser, and the program correctness problem