JAVA_Linked List Cycle_LeetCode 141


JAVA_Linked List Cycle_LeetCode 141

JAVA_Linked List Cycle_LeetCode 141 Linked List Cycle 풀이 public class Solution { public boolean hasCycle(ListNode head) { if(head == null || head.next == null) return false; ListNode fast = head, slow = head; while(fast.next != null && fast.next.next != null){ fast = fast.next.next; slow = slow.next; if(fast == slow) return true; } return false; } } * 출처 Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. l...


#JAVA #JAVA_LeetCode141 #JAVA_LinkedListCycle #JAVA_LinkedListCycle_LeetCode141 #LinkedListCycle_LeetCode141

원문링크 : JAVA_Linked List Cycle_LeetCode 141