FastPrepReverse Linked List
Problems/Reverse Linked List

Reverse Linked List

ByteDance logoByteDance● EasyINTERNPHONE SCREENONSITE INTERVIEW

Updated Dec 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Reported from a ByteDance interview for a summer software engineering internship on an ads team in the Bay Area, held as two video rounds; the report says there were not many follow-up questions.

The first question of round 2 asked the candidate to reverse a linked list. The report names it by that short title and a problem number that point to the well-known linked-list reversal task. The other question of that round, a course schedule task, is not part of this problem.

The report gives no input format, limits or examples. We used the usual form of this task and its usual limits; the examples are ours.

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

head is the first node of a singly linked list. Every node stores a value and points to the node after it; the last node points to null. Reverse the list: the last node comes first, and each link is turned around, so every node points to the node that was before it. Return the new first node.

An empty list is allowed: then head is null, and the answer is null too.

Function

reverseList(head: ListNode) → ListNode

Examples

Example 1

head = [6,-4,15,0,9,2]return = [2,9,0,15,-4,6]
head
6-415092
→
return
29015-46
Moved or new

Node 2 was last, so it comes first now. Every link is turned around: 9 now points to 0, 0 points to 15, and so on, and 6, the old first node, points to null. Reading from the new first node gives 2, 9, 0, 15, -4, 6.

Example 2

head = [2,2,7,2]return = [2,7,2,2]
head
2272
→
return
2722
Moved or new

Three nodes hold the value 2. They are still three separate nodes, and all of them stay in the list. Reversed, the values read 2, 7, 2, 2.

Example 3

head = [-17]return = [-17]
head
-17
→
return
-17

A list of one node is its own reverse: the node is both the first and the last node, and it still points to null.

Constraints

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

More ByteDance Phone Screen questions

  • Course SchedulePHONE SCREEN · ONSITE INTERVIEW · Seen Dec 2026
  • Implement QuicksortPHONE SCREEN · Seen Dec 2026
  • Largest Rectangle in HistogramPHONE SCREEN · ONSITE INTERVIEW · Seen Dec 2026
  • Count N-Queens PlacementsPHONE SCREEN · Seen Nov 2026
  • Matrix EscapePHONE SCREEN · Seen Nov 2026
  • Largest Number Below N from Reusable DigitsPHONE SCREEN · Seen Nov 2026
  • Log Analyzer: Busiest Service in a Rolling WindowPHONE SCREEN · Seen Nov 2026
  • Majority ElementPHONE SCREEN · Seen Nov 2026
  • Valid ParenthesesPHONE SCREEN · Seen Nov 2026
  • Binary Tree Target-Sum PathsPHONE SCREEN · Seen Nov 2026

Similar questions at other companies

  • Reverse Linked ListAutodesk · ONSITE INTERVIEWAutodesk interview questions
  • Merge Two Sorted ListsLinkedIn · PHONE SCREENLinkedIn interview questions
  • Reverse a Linked ListCisco · PHONE SCREENCisco interview questions
  • Reverse a Linked ListApple · PHONE SCREENApple interview questions
  • Reverse a Singly Linked ListChubb · PHONE SCREENChubb interview questions
  • Reverse a Singly Linked ListMicrosoft · ONSITE INTERVIEWMicrosoft interview questions
  • Reverse a Singly Linked ListAdobe · PHONE SCREENAdobe interview questions
  • Remove Linked List ElementsBloomberg LP · PHONE SCREENBloomberg LP interview questions
  • Merge Two Sorted ListsWhatNot · ONSITE INTERVIEWWhatNot interview questions
  • Remove Linked List Nodes with a Given ValueExpedia · ONSITE INTERVIEWExpedia interview questions

ByteDance interview experiences

  • ByteDance TikTok USDS SWE Intern Interview: 1 Experience
  • ByteDance MLE New Grad Interviews: 1 Experience
  • ByteDance Security SRE Intern Phone Screens: 1 Experience
  • ByteDance USDS New Grad SWE Phone Screen: 1 Experience
  • ByteDance New Grad Data Engineer Video Interviews: 1 Experience
  • ByteDance Trust & Safety Research Scientist Intern: 1 Experience
All ByteDance interview questionsSee ByteDance 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…