목록2024/03 (38)
넘치게 채우기
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://www.youtube.com/watch?v=K60IcPyCTIE 우리가 이용하는 대부분의 시스템에서 날짜 및 시간은 중요한데, 대부분의 디지털 시스템은 유닉스 시간을 사용한다. 이는 1970년 1월 1일 이후의 비윤년 초수를 나타내는데, 32비트의 부호가 있는 정수 형태로 저장된다. 그러나, 이 사용기간이 만료되어간다! 2038년 1월 19일에 정수 범위를 넘어선다고 한다. 이러면 오버플로우가 발생하여 시간이 음수로 나올 위험이 있는데, 이는 시스템에 큰 혼란을 초래한다. 다행히도, 임시적인 해결방안으로, 타임스탬프의 저장을 64비트로 하여, 2920억년 정도의 시간을 벌었다는 것이다! 많은 시스템들이 이 문제를 해결했다고 한다. 그러나, 네트워크 장비들이나 다른 임베디드 시스..
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..