Pregunta de entrevista de Samsara

Generic coding question, any programming language you want.