Pregunta de entrevista de Generally Intelligent

Typical leetcode tasks. Rather the easy ones.