CG Infinity Interview Question

Q. Coding question, print pattern