Skip to content

Latest commit

 

History

History

0143.reorder-list

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

Given a singly linked list L: L0→_L_1→…→_L_n-1→_L_n,reorder it to: L0→_L_n→_L_1→_L_n-1→_L_2→_L_n-2→…

You may not modify the values in the list's nodes, only nodes itself may be changed.

Example 1:

Given 1->2->3->4, reorder it to 1->4->2->3.

Example 2:

Given 1->2->3->4->5, reorder it to 1->5->2->4->3.

解题思路## 可能的變化