Macquarie Group interview question

Shorting array and some coding