Search⌘ K
AI Features

Maximum Subarray

Explore how to identify the maximum contiguous subarray sum in an integer array. Understand the problem constraints and implement an optimal solution that runs in linear time and constant space. This lesson prepares you to solve this classic coding interview challenge confidently.

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:

  • 11 \leq nums.length ...