FastPrepReverse a Linked List
Problems/Reverse a Linked List

Reverse a Linked List

Bank of America logoBank of America● EasyNEW GRADONSITE INTERVIEW

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Reported by a new grad software engineer from a Bank of America campus hiring drive. In the third and last round, an interview with both technical and HR questions, one of the coding tasks was to reverse a linked list.

The report names only the task. Here, the list has up to 2,000 nodes with values from -10,000 to 10,000, and you return the head of the reversed list.

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

You are given head, the first node of a singly linked list. Turn it around: every node's next pointer should lead to the node that came before it, so the old last node becomes the first.

Return the head of the reversed list. An empty list is given as null, and its reverse is also null.

Function

reverseList(head: ListNode) → ListNode

Examples

Example 1

head = [12,-5,30,7,0]return = [0,7,30,-5,12]
head
12-53070
→
return
0730-512
Moved or new

The nodes hold 12, -5, 30, 7, 0 from head to tail. After the reversal, the old tail 0 is the head and the old head 12 is the tail, whose next is null.

Example 2

head = [-417]return = [-417]
head
-417
→
return
-417

A list with one node reads the same in both directions, so that node is returned.

Example 3

head = [-8,-8,3]return = [3,-8,-8]
head
-8-83
→
return
3-8-8
Moved or new

The two nodes with value -8 are different nodes. Both move behind 3, which is now the head.

Constraints

  • The list has 0 to 2000 nodes.
  • -10^4 <= Node.val <= 10^4

More Bank of America Onsite Interview questions

  • Centered Star PyramidONSITE INTERVIEW · Seen Nov 2025
  • Employees Without a ManagerONSITE INTERVIEW · Seen Nov 2025
  • Longest Substring Without Repeating CharactersONSITE INTERVIEW · Seen Nov 2025
  • N-th Fibonacci NumberONSITE INTERVIEW · Seen Nov 2025
  • Reverse Each Word in a SentenceONSITE INTERVIEW · Seen Nov 2025
  • Second Highest SalaryONSITE INTERVIEW · Seen Nov 2025
  • Three Numbers That Add Up to a TargetONSITE INTERVIEW · Seen Apr 2025
  • Duplicate RowsONSITE INTERVIEW · Seen Oct 2023
  • Factorial of a NumberONSITE INTERVIEW · Seen Oct 2023
  • Palindrome String CheckONSITE INTERVIEW · Seen Sep 2023

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
  • 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
  • Merge Two Sorted ListsLinkedIn · PHONE SCREENLinkedIn interview questions

Bank of America interview experiences

  • Bank of America interviews · December 2025
  • Bank of America OA · December 2025
  • Bank of America interviews · September 2026
  • Bank of America OA · September 2026
All Bank of America interview questionsSee Bank of America 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…