input: def findMaxSum(limit, array):
      """Find the maximum sum of a subarray that does not exceed the given upper limit.
      >>> findMaxSum(10, [1, 3, 5, 4, 2, 6])
      10
      >>> findMaxSum(7, [1, 3, 5, 4, 2, 6])
      7
      >>> findMaxSum(20, [1, 3, 5, 4, 2, 6])
      21
      >>> findMaxSum(0, [1, 3, 5, 4, 2, 6])
      0
      """
output:     max_sum = 0
      current_sum = 0
      for num in array:
          current_sum += num
          if current_sum > limit:
              current_sum = num
          if current_sum > max_sum:
              max_sum = current_sum
      return max_sum