728x90
Math.round()
-
[ LinkedList ] 876. Middle of the Linked List (JAVA)리트코드(Leetcode) 2023. 6. 8. 17:23
리트코드 JAVA로 876번 문제 풀이 1. 문제 내용 Given the head of a singly linked list, return the middle node of the linked list. If there are two middle nodes, return the second middle node. => head라는 이름의 링크드 리스트가 주어지고 그 리스트의 중간 노드를 반환하라. 만약 중간 노드가 2개라면 두 번째 노드를 반환하라. => 여기서 알 수 있는 것 : length가 홀수일 때와 짝수일 때를 구분해야 한다는 것! Example 1: Input: head = [1,2,3,4,5] Output: [3,4,5] Explanation: node 3이 중간 노드이다. Example 2..