Compute sum of longest positive subarray | Microsoft Interview Question