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:

public static class LinkedListNode { public String value; public LinkedListNode next; public LinkedListNode(String value) { this.value = value; } } LinkedListNode a = new LinkedListNode("A"); LinkedListNode b = new LinkedListNode("B"); LinkedListNode 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?

RUN
Code execution powered by Qualified.io

. . .