diff --git a/Algorithms/143.Reorder List/143. Reorder List.go b/Algorithms/143. Reorder List/143. Reorder List.go similarity index 86% rename from Algorithms/143.Reorder List/143. Reorder List.go rename to Algorithms/143. Reorder List/143. Reorder List.go index 2fae72a9..9fef7121 100644 --- a/Algorithms/143.Reorder List/143. Reorder List.go +++ b/Algorithms/143. Reorder List/143. Reorder List.go @@ -64,3 +64,16 @@ func reorderList_1(head *ListNode) *ListNode { } return head } + +func listToArray(head *ListNode) []int { + array := []int{} + if head == nil { + return array + } + cur := head + for cur != nil { + array = append(array, cur.Val) + cur = cur.Next + } + return array +} diff --git a/Algorithms/143.Reorder List/143. Reorder List_test.go b/Algorithms/143. Reorder List/143. Reorder List_test.go similarity index 100% rename from Algorithms/143.Reorder List/143. Reorder List_test.go rename to Algorithms/143. Reorder List/143. Reorder List_test.go diff --git a/Algorithms/143.Reorder List/README.md b/Algorithms/143. Reorder List/README.md similarity index 100% rename from Algorithms/143.Reorder List/README.md rename to Algorithms/143. Reorder List/README.md