in this video at 8:31 you declare static variable which declares onlly once and after every function call it not back track please tell me if we have 3 test case like
while(t–){
thisfunction ()
}
i mean for multiple tc will it value remain same or changes according to the next test case please tell me how to do in this case
Regarding this video
For multiple test cases,it will remain same. As static variables have only single copy.
For multiple test cases, you can pass a variable by reference to the build tree function.
in this -->>> https://ide.codingblocks.com/s/237177 question i am facing the same problem of static vlarialble it is runnning fine for one tc but failing for multiple tc due to static variable in line 20 please help me how to remove this error of static variable
Instead of taking a static variable i in the function, pass it by reference to the function after initializing it in the main function. So for each test case,it will be reinitialized.
Function would be something like this node* build(ll * in,ll * post,ll s,ll e,ll &i)
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.