Sum of two errors TLE error

I keep getting TLE error even though I’ve solved this is O(N). Please help !

Hi @harshvapilani,
There is logical error .In line 21 if(arr1.length>arr2.length) when this condition is true you are taking arr1[j] = carry+arr1[j]+arr2[j]-10; where j = m-1 … But m-1 is ones digit of arr2 but for arr1 it is not once digit … Lets say arr1 has size of 10 and arr2 has size 8 then you are adding once digit of arr2 with hundred digit of arr1. That is not the rule of addition . Eg:- 1011012345 + 19283937 … your code adds 3 of (1011012345) and 7 of (19283937) … that is not correct

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.