FastPrepRemove Even-Positioned Linked-List Nodes
Problems/Remove Even-Positioned Linked-List Nodes

Remove Even-Positioned Linked-List Nodes

Oracle logoOracle● EasyFULLTIMEPHONE SCREEN

Updated Sep 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: The original report specifies removing every even one-based position from a singly linked list. It does not define empty-input behavior, list validity, allocation rules, or input bounds; this exercise makes a conventional bounded, finite, acyclic, in-place contract explicit.

Given the head of a finite, acyclic singly linked list, remove every node whose one-based position in the original list is even and return the resulting head.

Keep the nodes originally at positions 1, 3, 5, ... in their original relative order. Relink the existing nodes; do not change any node value. The input list may be empty, in which case return an empty list.

Function

removeEvenPositionedNodes(head: ListNode) → ListNode

Examples

Example 1

head = [1,2,3,4,5]return = [1,3,5]
head
12345
Removed
→
return
135
Moved or new

The nodes originally at positions 2 and 4 are removed.

Example 2

head = [7,8]return = [7]
head
78
Removed
→
return
7

The second node is in an even position, so only the first node remains.

Example 3

head = []return = []
head
empty
return
empty

An empty list remains empty.

Constraints

  • 0 <= number of nodes <= 100000.
  • Every node value fits a signed 32-bit integer.
  • The input list is finite and contains no cycle.
  • Reuse the existing nodes and use O(1) auxiliary space.

More Oracle Phone Screen questions

  • Remove Parentheses from a Plus-Minus ExpressionPHONE SCREEN · Seen Nov 2026
  • Trapping Rain WaterPHONE SCREEN · Seen Oct 2026
  • Shortest Window by Distinct-Value SumPHONE SCREEN · Seen Oct 2026
  • Detect a Cycle in a Directed GraphPHONE SCREEN · Seen Oct 2026
  • Time-Based Key-Value StorePHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
  • Remove Adjacent Duplicates in String IIPHONE SCREEN · Seen Oct 2026
  • Sum Root-to-Leaf Binary NumbersPHONE SCREEN · Seen Oct 2026
  • Longest All-Present Attendance StreakPHONE SCREEN · Seen Oct 2026
  • Next PermutationPHONE SCREEN · Seen Sep 2026
  • Valid ParenthesesPHONE SCREEN · Seen Sep 2026

Similar questions at other companies

  • Reverse Linked ListByteDance · PHONE SCREEN · ONSITE INTERVIEWByteDance interview questions
  • Merge Two Sorted ListsLinkedIn · PHONE SCREENLinkedIn interview questions
  • Middle of a Linked ListCisco · PHONE SCREENCisco interview questions
  • Reverse a Linked ListApple · PHONE SCREENApple interview questions
  • Merge Two Sorted ListsIBM · PHONE SCREENIBM interview questions
  • Reverse a Singly Linked ListChubb · PHONE SCREENChubb interview questions
  • Remove All Repeated Values from a Linked ListArista Networks · PHONE SCREENArista Networks interview questions
  • Detect a Cycle in a Linked ListSalesforce · PHONE SCREENSalesforce interview questions
  • Find the Intersection Node of Two Linked ListsVisa · PHONE SCREENVisa interview questions
  • Reverse a Linked ListMygate · PHONE SCREENMygate interview questions

Oracle interview experiences

  • Oracle SWE Onsite Interview Experience: 1 Experience
All Oracle interview questionsSee Oracle 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 removeEvenPositionedNodes(ListNode head) {
        // TODO: keep only nodes from odd one-based positions.
    }
}
Checking account…