FastPrepReverse Linked List
Problems/Reverse Linked List

Reverse Linked List

Autodesk logoAutodesk● EasyFULLTIMEONSITE INTERVIEW

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Reported as one of three short coding questions in the opening round of a three-round video interview loop for a full-time senior software engineer role at Autodesk, a role working in C++, which the candidate had applied to online. That round was mostly questions on C++ fundamentals, and the coding questions were named only by their task. This problem covers the linked-list reversal one. The candidate passed and rated the interviews easy.

The report gives only the task, with no function, limits or examples. We used the form of the known problem of this name: a function that receives the head of the list and returns the new head, with its limits of 0 to 5000 nodes and values from -5000 to 5000. We assumed that an empty list gives an empty list. The examples are ours. The other two coding questions, the design round and the hiring manager round are not part of this problem.

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

Reverse a singly linked list. You receive its first node, head, and return the node that heads the reversed list.

Keep the same nodes and turn every link around: wherever node A pointed to node B, B now points to A. The old tail is now the first node and the old head is now the last. Values may repeat. An empty list (head is null) gives an empty list.

Function

reverseList(head: ListNode) → ListNode

Examples

Example 1

head = [3,8,1,6]return = [6,1,8,3]
head
3816
→
return
6183
Moved or new

Node 6 was last and now comes first. Each link points back to the node that used to precede it, so the values read 6, 1, 8, 3.

Example 2

head = [10,20]return = [20,10]
head
1020
→
return
2010
Moved or new

The two nodes swap places: 20 now links to 10, and 10 links to nothing.

Example 3

head = [-2,5,-2,9]return = [9,-2,5,-2]
head
-25-29
→
return
9-25-2
Moved or new

Values may be negative and may repeat. Both nodes holding -2 stay in the list, and following the reversed links reads 9, -2, 5, -2.

Constraints

  • 0 <= list length <= 5000
  • -5000 <= value of each node <= 5000

More Autodesk interview questions

  • Non-Repeating CharacterONSITE INTERVIEW · Seen Nov 2026
  • Remove Trailing ZerosONSITE INTERVIEW · Seen Nov 2026
  • LRU Cache with TTLONSITE INTERVIEW · Seen Oct 2026
  • Deep Merge with a Conflict ResolverONSITE INTERVIEW · Seen Mar 2026
  • Diagonal Bounce TraversalOA · Seen Oct 2026
  • Interleave Array HalvesOA · Seen Oct 2026
  • Latest Arrival to Catch a BusOA · Seen Oct 2026
  • Find Top Two TeamsOA · Seen Sep 2026
  • In-Memory Database with TTLOA · Seen Mar 2026

Similar questions at other companies

  • Reverse a Singly Linked ListMicrosoft · ONSITE INTERVIEWMicrosoft interview questions
  • Reverse a Singly Linked ListBloomberg LP · PHONE SCREEN · ONSITE INTERVIEWBloomberg LP interview questions
  • Merge Two Sorted ListsWhatNot · ONSITE INTERVIEWWhatNot interview questions
  • Remove Linked List Nodes with a Given ValueExpedia · ONSITE INTERVIEWExpedia interview questions
  • Reverse a Linked ListBank of America · ONSITE INTERVIEWBank of America interview questions
  • Sorted Doubly Linked List to Balanced BST In PlaceSalesforce · ONSITE INTERVIEWSalesforce interview questions
  • Reverse Nodes in K-GroupAmazon · ONSITE INTERVIEW
  • Merge K Sorted Linked ListsThe Walt Disney Company · OA · ONSITE INTERVIEWThe Walt Disney Company interview questions
  • Merge K Sorted ListsSkydio · ONSITE INTERVIEWSkydio interview questions
  • Merge K Sorted Linked Lists Into OneCapital One · ONSITE INTERVIEWCapital One interview questions

Autodesk interview experiences

  • Autodesk SDE Intern OA and Interviews: 5 Experiences
All Autodesk interview questionsSee Autodesk 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…