$ ./guess_the_languageProblem Solving — fill the blank
Problem Solving — fill the blank · hard · #295

What goes in the blank?

# Kadane: best sum of a contiguous subarray
best = cur = nums[0]
for x in nums[1:]:
    cur = max(x, cur ____ x)
    best = max(best, cur)

Answer: + (also accepted: +)

Each step either extends the running subarray by x or starts fresh at x.
Play Problem Solving ▸