Given an integer array `nums`, find the subarray with the largest sum, and return its sum.
A subarray is a contiguous non-empty sequence of elements within an array.
def max_subarray(nums: list[int]) -> int:
Given an integer array `nums`, find the subarray with the largest sum, and return its sum.
A subarray is a contiguous non-empty sequence of elements within an array.
def max_subarray(nums: list[int]) -> int: