Tap here to switch tabs
Problem
Submissions

Problem: Reverse Linked List II

Reverse Linked List II gives you a singly linked list and two positions, left and right. Reverse the nodes between those positions and return the modified list.

Statement

Given a singly linked list with nn nodes and two positions, left and right, the objective is to reverse the nodes of the list from left to right. Return the modified list.

Constraints:

  • 1≤1 \leq n ≤500\leq 500
  • −5000≤-5000 \leq node.value ≤5000\leq 5000
  • 1≤1 \leq left ≤\leq right ≤\leq n
⋮
Tap here to switch tabs
Problem
Submissions

Problem: Reverse Linked List II

Reverse Linked List II gives you a singly linked list and two positions, left and right. Reverse the nodes between those positions and return the modified list.

Statement

Given a singly linked list with nn nodes and two positions, left and right, the objective is to reverse the nodes of the list from left to right. Return the modified list.

Constraints:

  • 1≤1 \leq n ≤500\leq 500
  • −5000≤-5000 \leq node.value ≤5000\leq 5000
  • 1≤1 \leq left ≤\leq right ≤\leq n