Swap the K-th Node from the End with the Head in a Singly Linked List
Asked at Amplitude · Coding Questions · Difficulty: Medium · Last asked Jul 15, 2026
Given the head of a singly linked list `head` and an integer `k` (1-indexed), swap the **k-th node from the end** with the **head node**, using **O(1) extra space**, and return the new head.
Loading the problem…
More Amplitude interview questions
- Detect Cycles in Employee Reporting Structure
- Design and Implement Snake Game with Keyboard Input
- Validate Employees in a Hierarchy with Recursive Rules
- Dictionary Encoding (Lossless) for Comma-Separated Words
- Two-Team Turn-Based Battle Simulator
- Toy Language Type System