Runtime Error.Need help


#1

/**

  • Definition for singly-linked list.
  • struct ListNode {
  • int val;
    
  • ListNode *next;
    
  • ListNode(int x) : val(x), next(NULL) {}
    
  • };
    /
    ListNode
    Solution::deleteDuplicates(ListNode* A) {
    ListNode * temp=A;
    ListNode *s,*e;

while(temp!=NULL)
{
cout<<“lol”<<" “;
int test=temp->val;
cout<<test<<” ";
s=temp;
while(temp->val == test && temp!=NULL)
{
temp=temp->next;
}
if(temp == NULL)
s->next=NULL;
else
{ e=temp;
s->next=e;
}
}
return A;

}


#2

if(A==NULL){
return 0;
}
This is a boundary case!.
try submitting including this.
Hope it helps!!