Tap here to switch tabs
Problem
Submissions

Problem: Maximum Subarray

Maximum Subarray asks you to find the contiguous subarray with the greatest sum in an integer array and return that sum, even when all available values are negative.

Statement

Given an integer array, nums, find the contiguous subarray that has the largest sum and return its sum.

Note: A subarray is a contiguous part of an array that contains at least one number.

Constraints:

  • 1≤1 \leq nums.length ≤103\leq 10^3

  • −104≤-10^4 \leq nums[i] ≤104\leq 10^4

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Maximum Subarray

Maximum Subarray asks you to find the contiguous subarray with the greatest sum in an integer array and return that sum, even when all available values are negative.

Statement

Given an integer array, nums, find the contiguous subarray that has the largest sum and return its sum.

Note: A subarray is a contiguous part of an array that contains at least one number.

Constraints:

  • 1≤1 \leq nums.length ≤103\leq 10^3

  • −104≤-10^4 \leq nums[i] ≤104\leq 10^4