Minimum Value to Get Positive Step by Step Sum

Given an integer array nums, return the minimum positive integer x such that the prefix sum of (i+x) of the array remains always positive.

Input: Integer array nums.

Output: Integer x.

...

Example

Unlock to view complete problem details

and practice with sample input/output

Was this article helpful?

View Test Cases & Run Code requires membership

Standard Input
Execution Result: