欢迎光临散文网 会员登陆 & 注册

一看就会一写就跪,90%开发都会的经典题,你能10分钟AC吗

2023-07-30 21:56 作者:Acer在写代码  | 我要投稿
func swapPairs(head *ListNode) *ListNode {
   if head == nil || head.Next == nil {
      return head
   }
   next := head.Next
   head.Next = swapPairs(next.Next)
   //值的交换
   next.Next = head
   return next
}


一看就会一写就跪,90%开发都会的经典题,你能10分钟AC吗的评论 (共 条)

分享到微博请遵守国家法律