Reverse a singly linked list robustly
Company: NVIDIA
Role: Data Scientist
Category: Coding & Algorithms
Difficulty: hard
Interview Round: HR Screen
Overview: This question evaluates linked-list manipulation skills including in-place iterative reversal, recursive techniques, cycle detection and handling, time and space complexity analysis, loop invariants, and minimal test design.
Read the full NVIDIA Data Scientist interview experience this question came from
Examples
Input: ([1, 2, 3], None)
Expected Output: [3, 2, 1]
Explanation: Basic reversal.
Input: ([], None)
Expected Output: []
Explanation: Empty list.
Hints
- Iterative pointer reversal is O(1) extra space; detect cycles first when node references are available.