• + 0 comments
    def fibonacciModified(t1, t2, n):
        if n==1:
            return t1;
        elif n==2:
            return t2;
        else:
            nt1 = fibonacciModified(t1, t2, n-2)
            nt2 = fibonacciModified(t1, t2, n-1)
            return nt1 + nt2*nt2;
    

    yeah memoization would be helpful