for binom memoization complexity