The TransCompilator

Solved LeetCode program · 92 of 1,000

#0092 · Reverse Linked List II

Medium Linked List chunk-02.md

Original English source

The values is a list of 1, 2, 3, 4, and 5. The leftedge is 2. The rightedge is 4. The left is leftedge minus 1. The right is rightedge minus 1. Repeat while left is less than right, swap item left of values and item right of values, add 1 to left, subtract 1 from right.

For each value in values, report value.

Open in Playground Browse all 1,000 problems

Expected stdout

1
4
3
2
5