fork download
  1. ListNode* Solution::deleteDuplicates(ListNode* A) {
  2. if(A==NULL)
  3. {
  4. return NULL;
  5. }
  6. if(A->next==NULL)
  7. {
  8. return A;
  9. }
  10. ListNode *a = A;
  11. ListNode *b = A->next;
  12.  
  13. while(b != NULL){
  14. if(a->val == b->val)
  15. {
  16. b = b->next;
  17. }
  18. else
  19. {
  20. a->next=b;
  21. a=b;
  22. b= b->next;
  23. }
  24. }
  25. a->next=NULL;
  26.  
  27. return A;
  28. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp:1:1: error: ‘ListNode’ does not name a type
 ListNode* Solution::deleteDuplicates(ListNode* A) {
 ^~~~~~~~
stdout
Standard output is empty