We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
if the linked list consists of 1,2,3,4,5 it will show nullpointer exception since fast=2,4 then fast!=null and neither is fast.next=null but fast.next.next=null
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Linked Lists: Detect a Cycle
You are viewing a single comment's thread. Return to all comments →
if the linked list consists of 1,2,3,4,5 it will show nullpointer exception since fast=2,4 then fast!=null and neither is fast.next=null but fast.next.next=null