Get a free weekly practice problem!

Keep that axe sharp.

× No thanks

Just No more free questions left!

Upgrade Now

Delete a node from a singly-linked list, given only a variable pointing to that node.

The input could, for example, be the variable b below:

function LinkedListNode(value) { this.value = value; this.next = null; } var a = new LinkedListNode('A'); var b = new LinkedListNode('B'); var c = new LinkedListNode('C'); a.next = b; b.next = c; deleteNode(b);

We can do this in time and space! But our answer is tricky, and it could have some side effects...

You must log in with one click to view the rest.

Once you're logged in, you'll get free full access to this and 4 other questions.

You must log in with one click to view the rest.

Once you're logged in, you'll get free full access to this and 4 other questions.

time and space.

You must log in with one click to view the rest.

Once you're logged in, you'll get free full access to this and 4 other questions.

What's next?

Powered by qualified.io

. . .