Sort by

recency

|

716 Discussions

|

  • + 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

  • + 0 comments

    So this isn't dynamic programming at all unless dp = having to change the submission system for it to be valid...

  • + 0 comments

    Can anyone shed light on how to complete this problem in Cpp. The problem requires the function to return int while the ouput can exceed the bound of a 32-bit integer? Does this not make it fundamentally impossible to correctly implement a Cpp solution? Am I dumb (yes but thats beside the point)...?

  • + 0 comments

    this is my code in python, it exceeded the time with Python3 but passed with PyPy3

    def fibonacciModified(t1, t2, n):
        prev, prev2 = t2, t1
        
        for step in range(2,n):
            prev, prev2 = prev**2 + prev2, prev
    
        return prev
    
  • + 0 comments

    the number is too big