Pregunta de entrevista de Ace Micromatic

In coding test they asked us to write the logic for some patterns.