TalentPace interview question

pattern program