I know I can minimalize this code by making a function but ignoring that, why is the code not giving the desired output?
Sum of two arrays
@abhi18sinha,
Garbage value is printed because you are not initialising final array with 0s. Also, answer will still be wrong, you should dry run on the test case to find out the bug.
Why isn’t this still working?
@abhi18sinha,
You should dry run on this:
Input
1
1
1
1
Take a pen/paper, and simulate what you are trying to code on paper, also keep checking intermediate results by printing them, you will see where the code fails.
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.