Search
⌘K

Leetcode 1413. Minimum Value to Get Positive Step by Step Sum

Find the smallest positive startValue such that when added to the running sum of nums (prefix sums), every cumulative total stays at least 1. This reduces to scanning the array for the minimum prefix sum and choosing startValue = max(1, 1 - minPrefix).


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Comments

Your account is free and you can post anonymously if you choose.