My code URL is :-https://ide.codingblocks.com/s/642925
plz correct my code
Hey are you trying to submit this somewhere cause it maybe related to input.
I submitted your code here https://leetcode.com/problems/reverse-linked-list/
It works fine.
I only used your reverse list function.
class Solution {
public:
ListNode* reverseList(ListNode* head) {
if(head==NULL || head->next == NULL){
return head;
}
//rec case
ListNode shead=reverseList(head->next);
ListNodetemp=head->next;
head->next=NULL;
temp->next=head;
return shead;
}
};
`
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.