Ruby keep return no method error when you return head.next


  • 0
    W

    lets say
    head = ListNode.new(0)
    tail = head.next

    tmp = ListNode.new(3)

    tail = tmp

    return head.next.val

    Even this gives no 'val' method. Most of time it return head.next = nil as well...


Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.