My Blog List

[Leetcode Solution] Reorder List

Great Problem

Analysis

  • Problem is quiet straightforward about linked list operation
  • First step find the node in the mid of linked list
  • Split the list into two part
  • Reverse the the latter half
  • Merge these two linked list

Note

  • Find the mid element in a linked list (If a linked list needs to be evenly divided, the first element of second hash list should be the mid one)
  • Reverse a linked list
  • Merger linked lists

Code