leetcode 19:刪除鏈表的倒數第N個節點

ListNode* removeNthFromEnd(ListNode* head, int n) { ListNode*l1=head; int c=0; while(l1!=NULL) { c+=1; l1=l1->next; } if(c==n)return head->next; if(c<n)retu
相關文章
相關標籤/搜索