Friday, 9 August 2013

handling large numbers and overflows

handling large numbers and overflows

I am given an array of N elements and I need to find the index P within
this array where sum of values in the rage 0 to P is equal to sum of
values in the range P+1 to N-1.
The values of each element in the array can range to -2147483648 to
2147483647 and N can be max 10000000.
Given this how do I ensure there is no overflow when adding each values to
find the index P ?

No comments:

Post a Comment