only 2 elements are showing up when accounting to
5
1 2 2 2 1
for this testcase.
this is the code.
Even after odd Error Linked List
@Vivek-Pandey-2129725577345937 do not update even-start->next = NULL inside while loop (at line 54 )cause temp and even_start are pointing towards same place ,setting it’s next as null will cause your while loop to terminate after first even you found.
update it outside for loop.
@sdevwrat you mean outside while loop right but updating it outside while loop will also result in same isn’t it. So i decided to eliminate it and it is giving the correct output but it is showing run error for a test case and all the test cases are passed
here is the code .
can you give me any idea likewise what can be the possible test case for which it is failing .
@Vivek-Pandey-2129725577345937 your code is failing in the case where all numbers are either even or all numbers are odd.