finding middle of linked list, running into strange nullptr error when I should not be (fast.next.next)

前端 未结 0 951
鱼传尺愫
鱼传尺愫 2021-02-01 13:53

Here\'s my code to find the middle of the linked list:

public ListNode findMiddleNode(ListNode head) {
    if(head == null){return null;}
    if(head.next == null         


        
相关标签:
回答
  • 消灭零回复
提交回复
热议问题