Accenture interview question

Aptitude question Two coding questions