목록single linked list (1)
코딩쌀롱
[LeetCode_JS] 83. Remove Duplicates from Sorted List
문제 LeetCode 83. Remove Duplicates from Sorted List 문제 input: 싱글 링크드 리스트의 head node output: 중복 val인 노드들을 제거한 링크드 리스트의 head node // Definition for singly-linked list. function ListNode(val, next) { this.val = (val===undefined ? 0 : val) this.next = (next===undefined ? null : next) } 노드들은 val, next 속성을 가지고 있다. 나의 풀이 while문 마지막에 현재 노드를 다음 노드로 바꿔주고, 현재 노드가 끝까지 가서 null일 때 while문을 더 이상 돌지 않게 했다. ✱바깥 wh..
개발공부
2021. 1. 13. 16:23