MCPcopy
hub / github.com/Jack-Lee-Hiter/AlgorithmsByPython / reorderList

Method reorderList

leetcode/143. Reorder List.py:19–24  ·  view source on GitHub ↗
(self, head)

Source from the content-addressed store, hash-verified

17
18class Solution(object):
19 def reorderList(self, head):
20 if not head or not head.next:
21 return
22 ahead, behind = self.split(head)
23 behind = self.reverse(behind)
24 head = self.reConnect(ahead, behind)
25 # split the linkedlist in middle
26 def split(self, head):
27 fast = head

Callers

nothing calls this directly

Calls 3

splitMethod · 0.95
reverseMethod · 0.95
reConnectMethod · 0.95

Tested by

no test coverage detected