Maximum Subarray (Kadane's Algorithm)
Medium · Arrays & Strings · about 15 minutes
Asked at Amazon, Microsoft, LinkedIn, Apple.
Given an integer array nums (at least one element), find the contiguous non-empty subarray with the largest sum and return that sum.