JAVA_LeetCode 82_Remove Duplicates from Sorted List II 풀이 class Solution { public ListNode deleteDuplicates(ListNode head) { // 더미 노드와 head 노드를 따로 초기화해준다음, 조건에 부합할때마다 노드를 변경해준다. ListNode node = new ListNode(0); // 더미 노드 생성 node.next = head; ListNode prev = node; // 중복 없는 마지막 노드 ListNode curr = head; boolean bool; while(curr !
= null){ bool = false; while(curr.next != null && curr.val == curr.next.val){ // 현재 중복되는 구간 curr = curr.next; bool = true; } if(bool){ // 중복구간 다음으로 건너뛰도록 변경 prev.next = curr...