Registry Mirror
搜索
Skip to content
You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
Dismiss alert
{{ message }}
Files
Expand file tree
master
Breadcrumbs
leetcode
/
algorithms
/
python
/
PartitionList
/
partition.py
Copy path
Blame
More file actions
Blame
More file actions
Latest commit
History
History
History
14 lines (14 loc) · 325 Bytes
master
Breadcrumbs
leetcode
/
algorithms
/
python
/
PartitionList
/
partition.py
Copy path
Top
File metadata and controls
Code
Blame
14 lines (14 loc) · 325 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
def partition(self, head, x):
h1 = l1 = ListNode(0)
h2 = l2 = ListNode(0)
while head:
if head.val < x:
l1.next = head
l1 = l1.next
else:
l2.next = head
l2 = l2.next
head = head.next
l2.next = None
l1.next = h2.next
return h1.next
You can’t perform that action at this time.