전체 글
-
[Leetcode] 986. Interval List Intersections 문제풀이Algorithm/문제풀이 2021. 9. 18. 16:23
https://leetcode.com/problems/interval-list-intersections/ Interval List Intersections - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com 문제 내용 2개의 스케줄 리스트가 있는데 겹치는 부분 출력하기 Example 1: Input: firstList = [[0,2],[5,10],[13,23],[24,25]], secondList = [[1,5],[8,12],[15,24],[25,26]] Outp..
-
[Leetcode] 844. Backspace String Compare 문제풀이Algorithm/문제풀이 2021. 9. 18. 15:45
https://leetcode.com/problems/backspace-string-compare/ Backspace String Compare - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com 문제 내용 문자열 2개에 backspace(문자 1개 지우는 키)가 포함된 문자열로 주어진다. 문자열 2개의 최종 결과값이 같은지 비교하는 문제 Example 1: Input: s = "ab#c", t = "ad#c" Output: true Explanation: Bot..
-
[Leetcode] 15. 3Sum 문제풀이Algorithm/문제풀이 2021. 9. 18. 13:27
https://leetcode.com/problems/3sum/ 3Sum - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com 문제 내용 배열에서 서로 다른 값 3개로 0을 만드는 원소들의 집합구하기 Example 1: Input: nums = [-1,0,1,2,-1,-4] Output: [[-1,-1,2],[-1,0,1]] 문제 풀이 변수 1개를 고정하면 2sum문제로 풀 수 있다. hash를 이용해서 값이 주어지면 값에 맞는 index를 바로 가져올 수 있도록 ..
-
[Leetcode] 82. Remove Duplicates from Sorted List II 문제 풀이Algorithm/문제풀이 2021. 9. 17. 21:34
https://leetcode.com/problems/remove-duplicates-from-sorted-list-ii/ Remove Duplicates from Sorted List II - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com 문제 내용 정렬된 리스트에서 중복된 요소 다 제거하는 문제 Input: head = [1,2,3,3,4,4,5] Output: [1,2,5] 문제 풀이 같은 수의 end 노드를 찾고 next랑 prev랑 연결하는 방식으로 풀..
-
[Leetcode] 350. Intersection of Two Arrays II 문제 풀이Algorithm/문제풀이 2021. 9. 17. 21:13
https://leetcode.com/problems/intersection-of-two-arrays-ii/ Intersection of Two Arrays II - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com 문제 내용 숫자 집합 2개가 주어지는 데 교집합을 구하면 된다. Example 1: Input: nums1 = [1,2,2,1], nums2 = [2,2] Output: [2,2] 문제 풀이 숫자 범위가 크지 않기 때문에 hash를 사용해서 풀었다. 1..
-
[Leetcode] 74. Search a 2D Matrix 문제 풀이Algorithm/문제풀이 2021. 9. 14. 22:59
https://leetcode.com/problems/search-a-2d-matrix/ Search a 2D Matrix - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com 문제 내용 2차원 배열이 정렬되어 있는 데 배열에서 target 찾기 Example 1: Input: matrix = [[1,3,5,7],[10,11,16,20],[23,30,34,60]], target = 3 Output: true 문제 풀이 binary search 2번 사용해서 풀었다...
-
[Leetcode] 33. Search in Rotated Sorted Array 문제 풀이Algorithm/문제풀이 2021. 9. 14. 22:30
https://leetcode.com/problems/search-in-rotated-sorted-array/ Search in Rotated Sorted Array - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com 문제 내용 정렬된 배열이 rotate되어 있다. rorate 되어 있는 배열에서 값 찾는 문제 Example 1: Input: nums = [4,5,6,7,0,1,2], target = 0 Output: 4 문제 풀이 binary search 로 풀..
-
[Leetcode] 34. Find First and Last Position of Element in Sorted Array 문제풀이Algorithm/문제풀이 2021. 9. 14. 22:21
https://leetcode.com/problems/find-first-and-last-position-of-element-in-sorted-array/ Find First and Last Position of Element in Sorted Array - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com 문제 내용 정렬된 배열에서 target 숫자가 중복되서 반복되는데 첫번째 index와 마지막 index를 출력하는 문제 Example 1: Input: nums..