input: Write a python function to optimize the given function using memoization.
  assert func(5) == 15
  assert func(10) == 55
  assert func(0) == 0
output: def func(n, memo={}):
      if n in memo:
          return memo[n]
      if n == 0:
          return 0
      result = n + func(n-1, memo)
      memo[n] = result
      return result