Codeflies interview question

Coding question of Star pattern