拆分链表

 Node slow = list.head,fast = list.head;
 Node last = null;
 
 while (fast != list.head && fast.next != list.head) {
     if (fast.next.next == list.head) last=fast.next;
     
     fast = fast.next.next;
     slow = slow.next;
 }
 
 if (fast.next == list.head) 
     fast.next = slow.next;
 else 
     last.next = slow.next;
 
 list.head2 = slow.next;
 slow.next = list.head;
 list.head1 = list.head;

在第 14 行得到 null 错误

其他部分 谁能帮我写代码?

eunsike 回答:拆分链表

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/27918.html

大家都在问