Company: Goldman sachs_27july
Difficulty: medium
Traveler Fund Problem Description A traveler is traveling form city of zeta to omega. He starts with X amount of money. Every day he spends some money and also he may work on some days to earn money. He may find good work some day and end up earning more than what he spends that day. It also may happen that he spends more than what he earns on any day. You are given an array of integers which represents his net savings (earning -expense) on any day. You need to find out minimum amount the traveler should begin with to ensure that he always have some money (>0) at the end of any day. Input Format The first line contains the array length N. Each of the next N lines contains one integer — the net savings (earning − expense) for that day. Constraints -200 <= a i <= 200, where a i are array elements 0 < i <= 100, where i is the array length X >= 0 Examples Example 1: Input: 3 4 2 -3 Output: 0 Explanation: Traveler saves $4 on first day, $2 on second day and $-3 on third day (