Reverse a Sublist
Medium · Linked Lists · about 20 minutes
Asked at Meta, Microsoft, Amazon.
Positions in the list are counted from 1, and left <= right. Reverse only the stretch of nodes from position left through position right, leaving the rest in place, and return the list's head. Aim for a single pass.