def _memoized_fibonacci_aux(n: int, memo: dict) -> int:
    """Auxiliary function of memoized_fibonacci."""
    if n == 0 or n == 1:
        return n
    if n not in memo:
        memo[n] = _memoized_fibonacci_aux(n - 1, memo) + \
                  _memoized_fibonacci_aux(n - 2, memo)
    return memo[n]