Design Gurus Logo
Reverse a Sub-list (medium)

Problem Statement

Given the head of a LinkedList and two positions p and q, reverse the LinkedList from position p to q.

Image

Constraints:

  • The number of nodes in the list is n.
  • 1 <= n <= 500
  • -500 <= Node.val <= 500
  • 1 <= p <= q <= n

Try it yourself

Try solving this question here:

Python3
Python3

. . . .

.....

.....

.....

Unlock this and all other premium problems.
No code editor for this lesson
This lesson focuses on concepts and theory