public boolean hasCycle(ListNode head) {
        if(head == null || head.next == null) return false;
        ListNode low = head;
        ListNode high = head.next;
        if(low == high) return true;
        while(high.next !=null && high.next.next != null)
        {
            low = low.next;
            high = high.next.next;
            if(low == high ) {
                return true;
            }
        }
        return false;
    }