LeetCode 237. 删除链表中的节点

 

 LeetCode 237. 删除链表中的节点

 

 

 1 /**
 2  * Definition for singly-linked list.
 3  * struct ListNode {
 4  *     int val;
 5  *     ListNode *next;
 6  *     ListNode(int x) : val(x), next(NULL) {}
 7  * };
 8  */
 9 class Solution {
10 public:
11     void deleteNode(ListNode* node) {
12         node->val = node->next->val;
13         node->next = node->next->next;
14     }
15 };

 

相关文章:

  • 2021-06-01
  • 2021-11-10
  • 2021-09-25
  • 2022-01-09
  • 2021-08-30
  • 2021-06-02
  • 2021-12-25
  • 2022-01-11
猜你喜欢
  • 2021-09-27
  • 2021-06-19
  • 2022-12-23
  • 2021-09-15
  • 2022-12-23
  • 2021-12-09
相关资源
相似解决方案