목록PS/LeetCode (586)
넘치게 채우기
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/task-scheduler/description/ Leetcode - Task Scheduler 문제 유형 : 그리디, 정렬 문제 난이도 : Medium 문제 You are given an array of CPU tasks, each represented by letters A to Z, and a cooling time, n. Each cycle or interval allows the completion of one task. Tasks can be completed in any order, but there's a constraint: identical tasks must be separated by at least n intervals due ..
https://leetcode.com/problems/minimum-number-of-arrows-to-burst-balloons/description/ Leetcode - Minimum Number of Arrows to Burst Balloons 문제 유형 : 그리디, 정렬 문제 난이도 : Medium 문제 There are some spherical balloons taped onto a flat wall that represents the XY-plane. The balloons are represented as a 2D integer array points where points[i] = [xstart, xend] denotes a balloon whose horizontal diameter s..
https://leetcode.com/problems/insert-interval/description/ Leetcode - Insert Interval 문제 유형 : 배열, 구현 문제 난이도 : Medium 문제 You are given an array of non-overlapping intervals intervals where intervals[i] = [starti, endi] represent the start and the end of the ith interval and intervals is sorted in ascending order by starti. You are also given an interval newInterval = [start, end] that represents ..
![](http://i1.daumcdn.net/thumb/C150x150/?fname=https://blog.kakaocdn.net/dn/RNb55/btsFPoAmj8x/8OYnZCXr1lh2Q18upzWEXK/img.png)
https://leetcode.com/problems/contiguous-array/description/ Leetcode - Contiguous Array 문제 유형 : 부분합, 해시 문제 난이도 : Medium 문제 Given a binary array nums, return the maximum length of a contiguous subarray with an equal number of 0 and 1. 바이너리 배열 nums가 주어진다. 0과 1의 개수가 같은 부분배열의 최대 길이를 구하시오. 풀이 부분합을 이용하여 풀 수 있다. 해시맵을 만들어서 총합-인덱스의 형태로 저장한다. 배열을 순회하면서, 총합에 0이면 -1을, 1이면 1을 추가한다. 만약 총합이 0이라면, 처음부터 i인덱스까지 조..
https://leetcode.com/problems/find-the-pivot-integer/description/ Leetcode - Find the Pivot Integer 문제 유형 : 수학 문제 난이도 : Easy 문제 Given a positive integer n, find the pivot integer x such that: The sum of all elements between 1 and x inclusively equals the sum of all elements between x and n inclusively. Return the pivot integer x. If no such integer exists, return -1. It is guaranteed that there ..
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/custom-sort-string/description/ Leetcode - Custom Sort String 문제 유형 : 문자열 처리, 정렬, 그리디 문제 난이도 : Medium 문제 You are given two strings order and s. All the characters of order are unique and were sorted in some custom order previously. Permute the characters of s so that they match the order that order was sorted. More specifically, if a character x occurs before a char..
https://leetcode.com/problems/intersection-of-two-arrays/description/ Leetcode - Intersection of Two Arrays 문제 유형 : 해시, 그리디 문제 난이도 : Easy 문제 Given two integer arrays nums1 and nums2, return an array of their intersection. Each element in the result must be unique and you may return the result in any order. 두 정수배열 nums1과 nums2가 주어진다. 교차점을 반환하시오. 결과의 각 요소는 값이 겹치면 안되고, 순서는 상관없습니다. 풀이 해시맵에 nums1의 요소..