input: Write a function to find the maximum sum of an array of non-negative integers that is less than or equal to a given upper limit value. If the given array is empty then 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
              if currentSum <= limit and currentSum > maxSum:
                  maxSum = currentSum
      return maxSum
  
  assert findMaxSum(10, [1, 3, 5, 4, 2, 6])==9
  assert findMaxSum(15, [2, 4, 6, 8])==14
  assert findMaxSum(5, [1, 1, 1, 1, 1])==5
  assert findMaxSum(0, [1, 2, 3])==0
  assert findMaxSum(5, [])==0
output: def findMaxSum(limit, array):
      maxSum = 0
      currentSum = 0
      for num in array:
          currentSum += num
          if currentSum > limit:
              currentSum = num
          if currentSum > maxSum:
              maxSum = currentSum
      return maxSum