Best Prefix End
Finds the earliest index where the running sum from index 0 reaches its maximum.
Answer
—
Prefix sums
Enter integers above to see the computation.
Returns the smallest index i where the prefix sum arr[0]+…+arr[i] is maximized. Ties are resolved by taking the earliest endpoint.