Pergunta de entrevista da empresa Enzigma

In f2f round they ask me to write a program for particular pattern printing