https://leetcode.com/problems/delete-node-in-a-linked-list

If you never saw this problem it can seems quite difficult, how you can delete node, if you are given only access to that node? You need to find previous node first? No, the trick is a modification of values in our list! If you have this type of quesitions on real interview, it is the first question you must ask your interviewer. If we can modify data, solution becomes very easy, only two lines: change value of node with value of next node and then change next element for next of next element.

Complexity. Both time and space comlexity is O(1).

class Solution:
    def deleteNode(self, node):
        node.val = node.next.val
        node.next = node.next.next

If you like the solution, you can upvote it on leetcode discussion section: Problem 0237