목록연결리스트 (19)
넘치게 채우기
https://leetcode.com/problems/double-a-number-represented-as-a-linked-list/description/leetcode - Double a Number Represented as a Linked List문제 유형 : 연결 리스트, 재귀문제 난이도 : Medium 문제You are given the head of a non-empty linked list representing a non-negative integer without leading zeroes.Return the head of the linked list after doubling it. 연결리스트의 Head를 받습니다.이 연결리스트는 양의 정수를 의미합니다.두 배 하시오. 풀이재귀적으로 ..
https://leetcode.com/problems/remove-nodes-from-linked-list/description/leetcode - Remove Nodes From Linked List문제 유형 : 연결 리스트, 재귀, 스택문제 난이도 : Medium 문제You are given the head of a linked list.Remove every node which has a node with a greater value anywhere to the right side of it.Return the head of the modified linked list. 연결리스트의 head가 주어진다.노드의 다음 노드들 중 더 큰 값이 있다면, 그 노드를 삭제하라.모든 작업이 끝나고 나서의 연결 ..
https://leetcode.com/problems/delete-node-in-a-linked-list/description/leetcode - Delete Node in a Linked List문제 유형 : 연결리스트문제 난이도 : Medium 문제There is a singly-linked list head and we want to delete a node node in it.You are given the node to be deleted node. You will not be given access to the first node of head.All the values of the linked list are unique, and it is guaranteed that the given no..
https://leetcode.com/problems/find-all-duplicates-in-an-array/description/ Leetcode - Find All Duplicaties in an Array 문제 유형 : 배열, 구현, 연결리스트 문제 난이도 : Medium 문제 Given an integer array nums of length n where all the integers of nums are in the range [1, n] and each integer appears once or twice, return an array of all the integers that appears twice. You must write an algorithm that runs in O(n) t..
https://leetcode.com/problems/reorder-list/description/ Leetcode - Reorder List 문제 유형 : 연결리스트, 스택 문제 난이도 : Medium 문제 You are given the head of a singly linked-list. The list can be represented as: L0 → L1 → … → Ln - 1 → Ln Reorder the list to be on the following form: L0 → Ln → L1 → Ln - 1 → L2 → Ln - 2 → … You may not modify the values in the list's nodes. Only nodes themselves may be changed. ..
https://leetcode.com/problems/palindrome-linked-list/description/ Leetcode - Palindrome Linked List 문제 유형 : 연결 리스트 문제 난이도 : Easy 문제 Given the head of a singly linked list, return true if it is a palindrome or false otherwise. Follow up: Could you do it in O(n) time and O(1) space? 단순 연결리스트의 head가 주어진다. 팰린드롬이면 true를, 아니라면 false를 반환하시오. ++: O(n)의 시간과 O(1)의 공간복잡도로 하실 수 있으시겠습니까? 풀이 그냥 따로 데이터를 저장하는 식..
https://leetcode.com/problems/reverse-linked-list/description/ Leetcode - Reverse Linked List 문제 유형 : 연결리스트 문제 난이도 : Easy 문제 Given the head of a singly linked list, reverse the list, and return the reversed list. 연결리스트의 head가 주어진다. 연결리스트를 뒤집어서 반환하시오. 풀이 반복문 또는 재귀로 풀 수 있다. 현재 노드의 포인터와 이전 노드에 대한 포인터가 필요하다. 재귀의 경우, 먼저 끝에 도달해서 head를 새로 찍은 다음에, 연결을 반대로 이어주면 된다. 반복문을 이용할 경우도 같다. 다음 노드의 포인터를 미리 찍어두고, 현..
![](http://i1.daumcdn.net/thumb/C150x150/?fname=https://blog.kakaocdn.net/dn/PBGWh/btsFXaAzo34/IFFk5xHgfDxhueYjsmmMck/img.png)
https://leetcode.com/problems/merge-in-between-linked-lists/description/ Leetcode - Merge In Between Linked Lists 문제 유형 : 연결 리스트 문제 난이도 : Medium 문제 You are given two linked lists: list1 and list2 of sizes n and m respectively. Remove list1's nodes from the ath node to the bth node, and put list2 in their place. The blue edges and nodes in the following figure indicate the result: Build the resul..
https://leetcode.com/problems/remove-zero-sum-consecutive-nodes-from-linked-list/description/ Leetcode - Remove Zero Sum Consecutive Nodes from Linked List 문제 유형 : 연결리스트, 재귀 문제 난이도 : Medium 문제 Given the head of a linked list, we repeatedly delete consecutive sequences of nodes that sum to 0 until there are no such sequences. After doing so, return the head of the final linked list. You may retur..
https://leetcode.com/problems/middle-of-the-linked-list/description/ Leetcode - Middle of the Linked List 문제 유형 : 연결리스트, 투포인터 문제 난이도 : Easy 문제 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. 단순 연결리스트의 헤드가 주어진다. 중간 노드를 반환하라. 두 개의 중앙 노드가 있다면, 두 번째 중앙 노드를 반환하라. 풀이 투 포인터를 이용해서 풀어주면 된다. 두 칸씩 이동하는 fast 한 칸..