PayPal interview question

some algorithm question regarding array