题目:
题解:
func partition(head *ListNode, x int) *ListNode {small := &ListNode{}smallHead := smalllarge := &ListNode{}largeHead := largefor head != nil {if head.Val < x {small.Next = headsmall = small.Next} else {large.Next = headlarge = large.Next}head = head.Next}large.Next = nilsmall.Next = largeHead.Nextreturn smallHead.Next
}