Code gives segmentation error!

is, my logic is correct?
if yes, so why it gives segmentation error.
code:-https://ide.codingblocks.com/s/354671

Hey @Nikhil-Jettley-2567269533523013 you have made doubly linked list to solve this problem, moreover you have to do it with a single linked list.

As far as this code in line number 37 instead of || replace &&. You will get your answer :slight_smile:

yes sir,we can do.but i thought its better solution,is ,the logic is correct?

please check my code.

Your logic is correct for double linked list,what if in interview you get single linked list.

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.