FastPrepReverse the Order of a Linked List
Problems/Reverse the Order of a Linked List

Reverse the Order of a Linked List

DocuSign logoDocuSign● EasyINTERNONSITE INTERVIEW

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: A report from February 2020 lists reversing a linked list as the second technical session of a three-part onsite.

The report gives no node values, limits or examples. Here the singly linked list has 0 to 5,000 nodes with values from -100,000 to 100,000, and you return the head of the reversed list. We wrote the examples.

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

You are given head, the first node of a singly linked list. Each node holds an integer val and a link next to the following node; the last node links to nothing. The list may be empty, in which case head is null.

Reverse the list so the nodes come in the opposite order, and return the head of the reversed list. The old last node becomes the new head.

Lists are written as their values from head to tail, for example [12,-5,30,7].

Function

reverseNodeOrder(head: ListNode) → ListNode

Examples

Example 1

head = [12,-5,30,7]return = [7,30,-5,12]
head
12-5307
→
return
730-512
Moved or new

The nodes are 12 → -5 → 30 → 7. After reversing, the last node (7) is the new head and every arrow points the other way: 7 → 30 → -5 → 12.

Example 2

head = [-4,0,-4,9]return = [9,-4,0,-4]
head
-40-49
→
return
9-40-4
Moved or new

Repeated values are separate nodes and both stay. Read from the end: 9, -4, 0, -4.

Example 3

head = [42]return = [42]
head
42
→
return
42

A list with one node is the same list when reversed.

Constraints

  • 0 <= number of nodes <= 5000
  • -105 <= node.val <= 105

More DocuSign Onsite Interview questions

  • Count Binary SubstringsONSITE INTERVIEW · Seen Sep 2026
  • Two Positions That Add Up to a TargetPHONE SCREEN · ONSITE INTERVIEW · Seen Sep 2026
  • Compress Consecutive Integer RangesONSITE INTERVIEW · Seen Aug 2026
  • JSON Schema Object ValidatorONSITE INTERVIEW · Seen Aug 2026
  • Most Transactions Kept Without Going NegativeONSITE INTERVIEW · Seen May 2025
  • Three-Part Splits With a Light MiddleONSITE INTERVIEW · Seen May 2025
  • Combine Two Sorted Lists Into OneONSITE INTERVIEW · Seen Apr 2022
  • Exact Palindrome CheckPHONE SCREEN · ONSITE INTERVIEW · Seen Apr 2022
  • Paired Words That Share a SubstringONSITE INTERVIEW · Seen Apr 2022
  • Reverse the Characters of a TextPHONE SCREEN · ONSITE INTERVIEW · Seen Apr 2022

Similar questions at other companies

  • Detect a Loop in a Linked ListEPAM · ONSITE INTERVIEWEPAM interview questions
  • Delete a Doubly Linked List Node at a PositionQualys · ONSITE INTERVIEWQualys interview questions
  • Insert After a Linked-List NodeAMD · ONSITE INTERVIEWAMD interview questions
  • Reverse a Singly Linked ListGoogle · ONSITE INTERVIEWGoogle interview questions
  • Process Singly Linked List OperationsSEDEMAC · ONSITE INTERVIEW
  • Merge Two Sorted Linked ListsZS · ONSITE INTERVIEWZS interview questions
  • Middle Node Of A Linked ListNVIDIA · ONSITE INTERVIEWNVIDIA interview questions
  • Build and Check a Palindrome Linked ListOmnissa · ONSITE INTERVIEWOmnissa interview questions
  • Reverse a Singly Linked ListGEP · ONSITE INTERVIEW
  • Merge Two Sorted Linked ListsApple · ONSITE INTERVIEWApple interview questions

Interview reports that mention this question

  • DocuSign SWE Intern Interviews: 27 Experiences (Part 2 of 2)

DocuSign interview experiences

  • DocuSign SWE Intern OA Questions: 53 Experiences (Part 1 of 2)
All DocuSign interview questionsSee DocuSign 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 reverseNodeOrder(ListNode head) {
        // Write your code here.
    }
}
Checking account…