input: Write a python function to calculate the factorial of a number using memoization.
  assert factorial(5) == 120
  assert factorial(6) == 720
  assert factorial(7) == 504
output: def factorial(n, memo={}):
      if n in memo:
          return memo[n]
      if n == 0 or n == 1:
          return 1
      memo[n] = n * factorial(n - 1, memo)
      return memo[n]