input: Write a function to find the maximum sum of an array of non-negative integers that does not exceed a given upper limit value. The function should iterate through the array and keep track of the maximum sum that is within the limit. Return the maximum sum found. If the array is empty, return 0.
  
  def findMaxSum(limit, array):
      maxSum = 0
      for i in range(len(array)):
          currentSum = 0
          for j in range(i, len(array)):
              currentSum += array[j]
              if currentSum <= limit and currentSum > maxSum:
                  maxSum = currentSum
      return maxSum
  
  assert findMaxSum(10, [1, 3, 5, 4, 2, 6]) == 10
  assert findMaxSum(20, [8, 4, 7, 5, 6]) == 20
  assert findMaxSum(5, [2, 3, 1, 1, 4]) == 5
  assert findMaxSum(7, [3, 2, 3, 1, 2]) == 7
  assert findMaxSum(0, []) == 0
output: def findMaxSum(limit, array):
      maxSum = 0
      currentSum = 0
      for num in array:
          currentSum += num
          if currentSum > limit:
              currentSum = 0
          elif currentSum > maxSum:
              maxSum = currentSum
      return maxSum