Output correct but test cases not passing


input is giving correct result but test cases are not passing

@akshatkaush
hello Akshat,
print output of each test cases in separate line.

est cases still not passing

image

n1 and n2 can be 0 as well so handle that case

still not working. i have again saved the code.

@akshatkaush
akshat,
please share ur updated code

check this.

u were again declaring node in ur else statement.

it’s not passing, and this linked list with 0 element is one case whereas while i’m submitting this code none of the test cases are passing

image
remove this return 0; statement from ur code.

yeah, now it passed, but why? This was’nt happening in any other code.

@akshatkaush
return 0; tells that program execution is finished successfully.
in ur code u are returning 0 just after ur first testcase which is wrong because some other testcases are there as well ,u should first complete execution for all test cases and then only return 0.