Macquarie Group Interview Question

Shorting array and some coding