Time Limit exceeded error

The code gives a TLE error even when the code is implemented similarly to the one provided in the editorial. Please let me know the issue.

Code Link: https://ide.codingblocks.com/s/483515

this is because you forgot to decrease t
and stuck in infinite loop

while(t > 0)

    {

        cin>>N;

        for(int i = 0; i < N; i++)

            cin>>A[i];

        cout<<max_bitcoin_length(N)<<endl;

        t--;  // it is important otherwise loop never finish

    }

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.