FastPrepDelete a Linked-List Node Without the Head
Problems/Delete a Linked-List Node Without the Head

Delete a Linked-List Node Without the Head

Capillary Technologies logoCapillary Technologies● MediumFULLTIMEONSITE INTERVIEW

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: The source names the standard task of deleting a node without the head pointer, but it does not show the interface, examples, limits or how the output looks. In our version, the input holds the target node and the rest of the list from that node on. Your function returns the list, so the in-place change can be seen. Our version is about 75% the same as the reported question.

You are given only a node node from a singly linked list. You are not given the list's head. Delete node from the list in place.

The provided node is guaranteed not to be the tail. Copy the successor's value into node, bypass that successor, and return node. The returned list therefore represents the suffix beginning at the original target position after deletion.

Function

deleteNode(node: ListNode) → ListNode

Examples

Example 1

node = [5,1,9]return = [1,9]
node
519
Removed
→
return
19
Moved or new

The target contains 5. Copy 1 from its successor into the target, then bypass that successor.

Example 2

node = [7,3]return = [3]
node
73
Removed
→
return
3
Moved or new

The target takes its successor's value 3 and becomes the last node.

Constraints

  • The provided node is not null.
  • The provided node is not the tail node.
  • The serialized suffix contains between 2 and 10^5 nodes.
  • Each node value fits in a 32-bit signed integer.

More Capillary Technologies Onsite Interview questions

  • Top View of a Binary TreeONSITE INTERVIEW · Seen Jul 2026

Similar questions at other companies

  • Reverse a Sublist of a Linked ListSalesforce · ONSITE INTERVIEWSalesforce interview questions
  • LRU CacheLotusFlare · ONSITE INTERVIEW
  • LRU Cache for Query ResultsAmazon · PHONE SCREEN · ONSITE INTERVIEW
  • Remove Nth Node From End of ListDruva · ONSITE INTERVIEW
  • Merge a List In Between Two PositionsWalmart · ONSITE INTERVIEWWalmart interview questions
  • LRU CacheJP Morgan Chase · ONSITE INTERVIEWJP Morgan Chase interview questions
  • LRU Cache OperationsHevo Data · ONSITE INTERVIEW
  • LRU Cache OperationsLinkedIn · ONSITE INTERVIEWLinkedIn interview questions
  • First-Fit Memory AllocatorGoogle · ONSITE INTERVIEWGoogle interview questions
  • Find the Entry of a Linked List CycleQualys · ONSITE INTERVIEWQualys interview questions
All Capillary Technologies interview questionsSee Capillary Technologies hiring insights
Saved
/**
 * Definition for singly-linked list.
 * public class ListNode {
 *     int val;
 *     ListNode next;
 *     ListNode() {}
 *     ListNode(int val) { this.val = val; }
 *     ListNode(int val, ListNode next) { this.val = val; this.next = next; }
 * }
 */
class Solution {
    public ListNode deleteNode(ListNode node) {
        // write your code here
    }
}
Checking account…