PayPal Interview Question

I was asked a question similar to Maximum Product Subarray