FastPrepReverse Linked List
Problems/Reverse Linked List

Reverse Linked List

The Walt Disney Company logoThe Walt Disney Company● EasyFULLTIMEOAONSITE INTERVIEW
QuestionFunctionExamplesConstraints

Problem statement

Source note: The report names LC206 as one of the coding tasks.

The report does not give a signature or bounds. Here, the input is an acyclic singly linked list with at most 500 nodes, and the same nodes are linked in reverse order.

The judged task matches the report at about 90%.

Given the head of a singly linked list, reverse its node order by changing its next pointers and return the new head. Keep every node value unchanged.

The input is a finite acyclic list. Its displayed array lists node values from head to tail; [] represents a null head.

Function

reverseList(head: ListNode) → ListNode

Examples

Example 1

head = [4,1,7]return = [7,1,4]

The node order 4 → 1 → 7 becomes 7 → 1 → 4. The new tail points to null, so the result is [7,1,4].

Example 2

head = []return = []

There are no nodes to reverse. Return null, displayed as [].

Constraints

  • 0 <= head.length <= 500
  • -1000000 <= head[i] <= 1000000

More The Walt Disney Company problems

  • Find All Paths for a Name in a File SystemPHONE SCREEN · Seen Nov 2026
  • Resizable Array-Backed Integer SetPHONE SCREEN · Seen Sep 2026
  • Shortest Path with Directional Move CostsPHONE SCREEN · Seen Sep 2026
All The Walt Disney Company interview questionsSee The Walt Disney Company 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 reverseList(ListNode head) {
        // Write your code here
    }
}
Checking account…