Getting TLE for all test cases

Refer for code: -

hello @ambuj_0909
check maximum value of n and declare temp array with size greater than that

@aman212yadav
I am still getting TLE error after initializing temp array with max value of n.
Could you please look into it?

pls share ur updated code using cb ide


Refer for code

declare ur temp array as global array and then submit

Thanks @aman212yadav
Could you explain the reason to declare it globally?

global scope has higher memory capacity than function scope.

thats why i said to declare it as global

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.