목록LIST (3)
어흥
문제 링크: www.hackerrank.com/challenges/find-the-merge-point-of-two-joined-linked-lists/problem?h_r=internal-search Find Merge Point of Two Lists | HackerRank Given two linked lists, find the node where they merge into one. www.hackerrank.com 1. 주의할 점 - 최악의 경우 N*M의 시간복잡도가 발생하지만, 통과한다 2. 구현 - While문 2개를 이용해서 브루트포스 느낌으로 구현할 수 있지만, Discussion에서 다른 사람의 풀이를 통해 살짝(?) 다른 접근을 해보자 - head1와 같은 주소를 가리키는 a를, h..
문제 링크: www.hackerrank.com/challenges/delete-duplicate-value-nodes-from-a-sorted-linked-list/problem?h_r=internal-search Delete duplicate-value nodes from a sorted linked list | HackerRank Given a linked list whose nodes have data in ascending order, delete some nodes so that no value occurs more than once. www.hackerrank.com 1. 주의할 점 - 입력받는 List는 오름차순으로 정렬되어 있다 - 중복될 경우, 새로운 포인터를 이용한다 2. 구현 - He..
문제 링크: www.hackerrank.com/challenges/merge-two-sorted-linked-lists/problem?h_r=internal-search Merge two sorted linked lists | HackerRank Given the heads of two sorted linked lists, change their links to get a single, sorted linked list. www.hackerrank.com 1. 주의할 점 - 한쪽의 List가 먼저 끝나는 경우, 이에 대한 처리를 명확히 한다 2. 구현 - 2개의 List를 합할 SinglyLinkedList li를 생성한다 - 2개의 List가 모두 NULL을 가리키지 않는다면, 다음과 같은 작업을 반복..