Detective's Mood

The stress of the case is taking a toll. Each day, your mood fluctuates wildly. Some days are great, and others are filled with despair. Track the longest streak of "good mood days" to determine when you're most effective.

Input is denoted by a list of integers `nums`.

  • Each integer represents your mood score for a particular day: positive values are good days, and negative values are bad days.
  • Your task is to find the maximum sum of a contiguous subarray (a sequence of consecutive days). For example, given `nums = [-2, 1, -3, 4, -1, 2, 1, -5, 4]`, the maximum sum is `6` for the subarray `[4, -1, 2, 1]`.


Case 1

Input: nums = [-10, 3, 5, -1, 7, -20, 15, 18, -5, 10, -15, 4]


Case 2

The file is too big! Download as a file. Here

Submit Here