Why is this code not working?
Please help?
And Also tell any other approach for this.
Why is this code not working?
Please help?
And Also tell any other approach for this.
it’s for length.
lenght of ll
I want you to send me your entire code consisting all your functions
This is the whole code with all the functions that are insertAtHead,insertAtTail and length function and then I have inserted the elements into the stack and a queue and then I pop one element from queue and one element from stack as stack has a property LIFO.
So It will gonna arrange the elements in that way.
I am also making a new list and inserting there
Now I understood my mistake and I was pushing back at my original head that’s why it was giving the error
But then I removed the head2 and made head=NULL and inserting into head only and then it was giving o/p as 1234
Idk why
Corrected Code: -
So is it working fine now?
Nope, Again giving some errors.
Hey @cbcao263 try to use this approach https://ide.codingblocks.com/s/339037, It’s easy to understand and when I submitted it on leetcode, it got submitted
It will help you too.
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.