FastPrepReverse a Singly Linked List
Problems/Reverse a Singly Linked List

Reverse a Singly Linked List

NVIDIA logoNVIDIA● EasyNEW GRADPHONE SCREEN

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: An NVIDIA phone-screen interview report for a deep-learning role, posted on behalf of the candidate, names reversing a linked list as its first coding exercise. It leaves out the signature, the node format, the limits, and the rule for an empty list. Here we use an ordinary singly linked list.

Our version is about 75% the same as the reported question.

Given the head of a singly linked list, reverse the order of its nodes and return the head of the reversed list.

For this practice, each node contains an integer value and a next pointer. An empty list is represented by null and reverses to an empty list. The input and output examples use arrays to display list values in traversal order.

Function

reverseList(head: ListNode) → ListNode

Examples

Example 1

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

The tail node becomes the new head, followed by the previous nodes in reverse order.

Example 2

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

There are no nodes to reverse, so the result is empty.

Example 3

head = [7,7,-2]return = [-2,7,7]
head
77-2
→
return
-277
Moved or new

Repeated values remain separate nodes; the value order becomes -2 -> 7 -> 7.

Constraints

  • The list contains 0 to 100 nodes.
  • -10^4 <= node.val <= 10^4.
  • Return the nodes in exact reverse traversal order, preserving every value and occurrence.

More NVIDIA Phone Screen questions

  • Network Layer Execution OrderPHONE SCREEN · Seen Nov 2026
  • Paged KV Cache AccessPHONE SCREEN · Seen Nov 2026
  • Sliding Window Attention over a KV CachePHONE SCREEN · Seen Nov 2026
  • Summarize Server Healthcheck LogsPHONE SCREEN · Seen Oct 2026
  • Hash Partition OffsetsPHONE SCREEN · Seen Oct 2026
  • Filter Paginated Medical RecordsPHONE SCREEN · Seen Oct 2026
  • Least Frequently Used CachePHONE SCREEN · Seen Oct 2026
  • Parallel String Counts with a Custom Hash TablePHONE SCREEN · Seen Oct 2026
  • Simulate a Reference-Counted Smart PointerPHONE SCREEN · Seen Aug 2026
  • Streaming Top-K Frequent ElementsPHONE SCREEN · Seen Aug 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

NVIDIA interview experiences

  • NVIDIA Full-Time SWE Onsite Scheduling: 1 Experience
  • NVIDIA OA: What It Tests (2026)
  • NVIDIA DevOps, QA and Infra Intern Interviews: 12 Experiences
  • NVIDIA Ignite Internship OA Experience
  • NVIDIA Software Intern Interview Questions: 9 Experiences
  • NVIDIA Ignite SWE Intern OA Questions: 6 Experiences
All NVIDIA interview questionsSee NVIDIA 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…