def max_subarray_tabulate(nums: list[int]) -> int:
    """Returns the largest non-empty contiguous subarray sum

    Args:
        nums: An array of integers drawn from the range [-10^5, 10^5]

    Examples:
        >>> max_subarray_tabulate([-2,1,-3,4,-1,2,1,-5,4])
        6
        >>> max_subarray_tabulate([1])
        1
        >>> max_subarray_tabulate([5,4,-1,7,8])
        23
        >>> max_subarray_tabulate([])
        0

    """
    ## EDGE CASE ##
    if not nums:
        return 0

    ## INITIALIZE VARS ##
    # subarr_sum[i] contains the maximum possible sum achievable by a
    # contiguous subarray in nums consisting of nums[i] and, potentially,
    # the immediately *preceding* maximum sum contiguous subarray
    subarr_sum = nums.copy()  # subarr_sum[i] initialized with singleton subarray sums

    # Update each idx to contain the maximum contiguous subarry sum that could
    # be obtained by the inclusion of the element at that idx; in other words,
    # include a previously running subarray sum if it would produce a larger
    # sum, else ONLY include the element at that idx (thus starting a new
    # subarray partition)
    for i in range(1, len(nums)):
        if subarr_sum[i - 1] > 0:
            # a larger subarray sum would be achieved by including predecessor contiguous subarray
            subarr_sum[i] += subarr_sum[i - 1]
    return max(subarr_sum)