Accenture interview question

aptitude and psuedocode