Pregunta de entrevista de Motive

Some dumb algorithmic problems. Easier than expected