1
class Solution:
2
def sortList(self, head: Optional[ListNode]) -> Optional[ListNode]:
3
store = []
4
curr = head
5
while curr:
6
store.append(curr.val)
7
curr = curr.next
8
store.sort()
9
dummyNode = ListNode(0)
10
temp = dummyNode
11

12
for i in store:
13
x = ListNode(val=i)
14
temp.next = x
15
temp = x
16
return dummyNode.next

0

WPM •0 •0

100%

ACC •0 •0

0s

TIME •0