237. Delete Node in a Linked List¶ Time: $O(1)$ Space: $O(1)$ C++JavaPython 1 2 3 4 5 6 7class Solution { public: void deleteNode(ListNode* node) { node->val = node->next->val; node->next = node->next->next; } }; 1 2 3 4 5 6class Solution { public void deleteNode(ListNode node) { node.val = node.next.val; node.next = node.next.next; } } 1 2 3 4class Solution: def deleteNode(self, node): node.val = node.next.val node.next = node.next.next