FastPrepReverse a Linked List
Problems/Reverse a Linked List

Reverse a Linked List

Cisco logoCisco● EasyFULLTIMEPHONE SCREEN

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: In a Cisco interview, the first technical round had a networking and C part and a coding part. One coding question was to reverse a singly linked list.

The post gives no limits or examples. This version uses the usual form. You get the head node and return the new head, with up to 5000 nodes valued from -5000 to 5000.

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

You are given the head of a singly linked list. Reverse the list and return the head of the reversed list.

The list is shown in the examples as the values of its nodes from head to tail.

Function

reverseList(head: ListNode) → ListNode

Examples

Example 1

head = [1,2,3,4]return = [4,3,2,1]
head
1234
→
return
4321
Moved or new

The last node 4 becomes the new head, and every link now points the other way: 4 -> 3 -> 2 -> 1.

Example 2

head = [7]return = [7]
head
7
→
return
7

A list with one node is the same when reversed.

Example 3

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

An empty list stays empty, so the answer is an empty list.

Constraints

  • The number of nodes in the list is in the range [0, 5000].
  • -5000 <= Node.val <= 5000

More Cisco interview questions

  • Check if a String Is a PalindromePHONE SCREEN · Seen Nov 2026
  • Find Unique ElementsPHONE SCREEN · Seen Nov 2026
  • First Letter to Appear TwicePHONE SCREEN · Seen Nov 2026
  • Middle of a Linked ListPHONE SCREEN · Seen Nov 2026
  • Reverse a StringPHONE SCREEN · Seen Nov 2026
  • Valid ParenthesesPHONE SCREEN · Seen Nov 2026
  • K-Step Bit Flip with RetentionPHONE SCREEN · Seen Nov 2026
  • Longest Non-Repeating SubstringPHONE SCREEN · Seen Jul 2026
  • Todo Task Manager OperationsONSITE INTERVIEW · Seen Oct 2026
  • Find the Duplicate Number Without Modifying the ArrayONSITE INTERVIEW · Seen Sep 2026

Similar questions at other companies

  • Reverse a Linked ListApple · PHONE SCREENApple interview questions
  • Reverse a Singly Linked ListChubb · PHONE SCREENChubb interview questions
  • Reverse a Singly Linked ListAdobe · PHONE SCREENAdobe interview questions
  • Remove Linked List ElementsBloomberg LP · PHONE SCREENBloomberg LP interview questions
  • Reverse a Singly Linked ListExpedia · PHONE SCREEN · ONSITE INTERVIEWExpedia interview questions
  • Merge Two Sorted Linked ListsNutanix · PHONE SCREENNutanix interview questions
  • Reverse a Singly Linked ListSuperhuman · PHONE SCREENSuperhuman interview questions
  • Merge K Sorted Linked ListsBharatPe · PHONE SCREEN
  • Reverse Nodes in K-GroupByteDance · PHONE SCREENByteDance interview questions
  • Reverse a Singly Linked ListMicrosoft · ONSITE INTERVIEWMicrosoft interview questions
All Cisco interview questionsSee Cisco 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…