def _get_spaces_array_helper(n, memo):
    """Recursively determine number of spaces at each height.

    :param n: The height to find num spaces for.
    :param memo: Memoization table. But that dynamic programming tho!
    """
    # Base case.
    if n == 1:
        return memo[n-1]
    else:
        # Check if memo already has value.
        if memo[n-1] != 0:
            return memo[n-1]
        else:
            # Damn, gotta do some work.
            prev = _get_spaces_array_helper(n-1, memo)
            next_val = 2 * prev + 1
            memo[n-1] = next_val
            return next_val