Java rabbit/turtle solution

  • 0

    Can they say O(1) space instead of no extra space which is impossible

    public boolean hasCycle(ListNode head)
    		ListNode rabbit=head, turtle=head;
    			if(rabbit==null || ||
    				return false;
    			if( ||
    				return true;;;

Log in to reply

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