input:                         
  def findMaxSum(limit: int, array: List[int]) -> int:
      """ Find the maximum sum of the elements in the array that does not exceed the given upper limit value.
      >>> findMaxSum(10, [1, 3, 5, 4, 2, 6])
      10
      >>> findMaxSum(5, [1, 3, 5, 4, 2, 6])
      5
      """
output:     dp = [0] * (limit + 1)
      for num in array:
          for i in range(limit, num - 1, -1):
              dp[i] = max(dp[i], dp[i - num] + num)
      return dp[limit]