IQVIA interview question

pattern generation problem in coding