Shopify OA Question 2024 August | Linked List | on-campus
Question · Posted Jun 2026
Question: Reverse Linked List Problem Statement Given the head of a singly linked list, reverse the list, and return the reversed list. Constraints The number of nodes in the list is the range [0, 5000]. -5000 <= Node.val <= 5000 Examples Example 1: Input: head = [1,2,3,4,5] Output: [5,4,3,2,1] Explanation 1: We reverse all the next pointers. Node 1's next becomes null (it's now the tail). Node 2's next points to 1. Node 3's next points to 2. And so ...
The full answer & interview discussion are available to premium members.
Log in Create a free account