
[LeetCode] 142. Linked List Cycle II, Medium
·
CodingTest/LeetCode
1. 문제연결 리스트 head가 주어질 때, 사이클의 시작 노드를 반환하라. pos는 주어지지 않는다.2. 해결/** * Definition for singly-linked list. * class ListNode { * val: number * next: ListNode | null * constructor(val?: number, next?: ListNode | null) { * this.val = (val===undefined ? 0 : val) * this.next = (next===undefined ? null : next) * } * } */function detectCycle(head: ListNode | null): ListNode ..