Are they same giving wrong answer

sir my code is giving wrong outputs pls
could you tell me my mistake and modify it so that it may work ???
link is https://ide.codingblocks.com/s/138352

Hi @Tanna
In line 29, you do not need to call calc function again for (calc(a1,b1)&&calc(a2,b2)) since you have already computed for it above.
Also use indexing i-half for arrays a2 and b2 instead of i. Else garbage value will be taken in them for indices 0 to half.
Also, use lengths of a and b as parameters in the arguments in order to avoid creating new arrays of huge size. Why to call function for 50005 length again and again if we just have a string of length 20!

I hope this would help you optimize your code :slight_smile:

sir pl optimise it as i am unable to …
link is https://ide.codingblocks.com/s/138380

sir pls check my new code it is failing one test case
link is https://ide.codingblocks.com/s/138397
pls do reply