The recrusive solution,when it comes to n=9,bug appear!why


  • 0
    2

    int checkRecord(int n) {
    int time(int n,int A,int L);
    int num=time(n,0,0);
    return num;
    }
    int time(int n,int A,int L)
    {
    if(n==0)
    return 0;
    int num=time(n-1,A,0)+1;
    if(!A)
    A=1,num+=time(n-1,A,0)+1;
    if(!L)
    L=1,num+=time(n-1,A,L)+1;
    return num;![alt text](![image url](image url))
    }[link text]([link url](link url))


Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.