luoheng
9/6/2019 - 7:45 AM

Ladder

# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")

def solution(A, B):
    # write your code in Python 3.6
    n = max(A)
    F = [0] * (n + 1)
    F[0] = F[1] = 1
    for i in range(2, n + 1):
        F[i] = (F[i-1] + F[i-2]) % 2 ** 30
    Bi = [2**i for i in range(31)]
    return [F[A[i]]%Bi[B[i]] for i in range(len(A))]