Kadane Maximum Subarray Problem

Kadane Maximum Subarray Problem — ExecCode Easy DSA Practice

Solve the Kadane Maximum Subarray problem on ExecCode. Free online easy DSA practice in Arrays - Logic Building. Write and run code in Java, C++, Python — no signup required to run.

Problem description

Description You are given the input needed to solve Kadane Maximum Subarray. Your task is to compute the required answer and return maximum sum. A sequence of values is given, and order matters. In Kadane Maximum Subarray, the goal is to transform, count, or select values according to the exact rule. n, then array values.

Examples

Input {"nums": [1, 2, 3, -2, 5]}; Output 9. Input {"nums": [-1, -2, -3, -4]}; Output -1. Input {"nums": [-2, -3, 4, -1, -2, 1, 5, -3]}; Output 7

Constraints

1 <= len(nums) <= 10^5

Practice Kadane Maximum Subarray free on ExecCode. Browse DSA problems, topic map, and placement guides.