Middle Node Of A Linked List
Reported by candidates from Nvidia's online assessment. Pattern, common pitfall, and the honest play if you blank under the timer.
Nvidia reported this one in September 2026, and the detail that matters is in the statement: on an even-length list, you return the second of the two middle nodes. Example 2 shows it, [1,2,3,4,5,6] returns [4,5,6]. It's Middle Node of a Linked List, a fast and slow pointer problem with at most 100 nodes. If your OA invite lands this week, expect to write it in a few minutes. The only real risk is an off-by-one on even lengths. StealthCoder sits invisibly on your screen as a safety net if you blank mid-assessment, but this one is small enough to own yourself.
The problem
You are given the head of a singly linked list. Return the middle node of the list. If the list has an even number of nodes, return the second of the two middle nodes. The returned node is the start of the suffix that begins at the middle; callers observe the remaining values from that node to the end. Function middleNode(head: ListNode) → ListNode Examples Example 1 head = [1,2,3,4,5] return = [3,4,5] The list has five nodes. The middle node holds 3, so the remaining suffix is 3 -> 4 -> 5. Example 2 head = [1,2,3,4,5,6] return = [4,5,6] The list has six nodes, so the two middle nodes hold 3 and 4. The judged answer is the second middle, 4 -> 5 -> 6. Constraints The number of nodes is in the range [1, 100]. 1 <= node.val <= 100.
Reported by candidates. Source: FastPrep
Pattern and pitfall
The trick is two pointers. Start slow and fast both at head. Each loop, move slow one step and fast two steps. Loop while fast is not null and fast.next is not null. When fast runs off the end, slow sits on the middle. The loop condition is what gives you the second middle on even lists. For six nodes, slow ends at the node holding 4, which matches Example 2. The common pitfall is checking only fast.next, which crashes on null or lands on the first middle. Another is counting nodes in one pass and walking n/2 in a second. That works, but it's slower to write and invites index mistakes. Return the node itself, not its value, since callers read the suffix from it. If you freeze during the live OA, StealthCoder can surface this pointer loop from the problem on screen. Know it cold anyway, because it's a building block for harder list problems.
If this hits your live OA and you blank, StealthCoder solves it in seconds, invisible to the proctor.
You can drill Middle Node Of A Linked List cold, or you can hedge it. StealthCoder runs invisibly during screen share and surfaces a working solution in under 2 seconds. The proctor sees the IDE. They don't see what's behind it. Built by an Amazon engineer who would have shipped this the night before his JPMorgan OA if he'd had it.
Get StealthCoderRelated leaked OAs
This OA pattern shows up on LeetCode as middle of the linked list. If you have time before the OA, drill that.
You've seen the question.
Make sure you actually pass Nvidia's OA.
Nvidia reuses patterns across OAs. Built by an Amazon engineer who would have shipped this the night before his JPMorgan OA if he'd had it. Works on HackerRank, CodeSignal, CoderPad, and Karat.
Middle Node Of A Linked List FAQ
What's the trick to Middle Node of a Linked List?+
Use fast and slow pointers. Slow moves one step, fast moves two. When fast hits the end, slow is at the middle. Loop while fast and fast.next both exist, and you'll get the second middle on even-length lists automatically.
How do I get the second middle node on even lengths?+
Use the condition fast != null and fast.next != null. With six nodes, slow finishes on the node holding 4, which is the second middle. If you only check fast.next, you'll stop one node early and return 3 instead.
How hard is this problem really for the Nvidia OA?+
It's easy. Nvidia reported it in September 2026, and with at most 100 nodes there's no performance trap. The only way to miss it is an off-by-one on even lists or a null pointer error. Test with one node, two nodes, and five nodes before submitting.
Can I count the nodes first instead of using two pointers?+
Yes. Walk the list to get n, then walk n/2 steps from head. For n=6 that lands on index 3, the second middle. It's correct and still linear, just two passes. Two pointers is cleaner and interviewers usually expect it.
How do I prepare for this in 48 hours?+
Write the fast and slow loop from memory three times. Then run it by hand on [1], [1,2], [1,2,3,4,5], and [1,2,3,4,5,6]. Once those four traces match the expected suffixes, you're done. Spend the remaining time on other linked list patterns like cycle detection.