[LeetCode Curated Algo 170] 253. Meeting Rooms II
문제 253. Meeting Rooms II Given an array of meeting time intervals intervals where intervals[i] = [starti, endi], return the minimum number of conference rooms required. 한줄해석 : 회의의 시작시간, 종료시간 리스트를 입력으로 받아, 회의실이 총 몇개가 필요한지 구하라. Example 1: Input: intervals = [[0,30],[5,10],[15,20]] Output: 2 Example 2: Input: intervals = [[7,10],[2,4]] Output: 1 Constraints: 1
[Leetcode Algorithm I, Day2] [leetcode 283, leetcode 167 ][c++]
한줄평 : 와 오늘문제는 짧지만 아주 뇌를 자극해준다. HINT! 더보기 two pointer 283. Move Zeroes Given an integer array nums, move all 0's to the end of it while maintaining the relative order of the non-zero elements. Note that you must do this in-place without making a copy of the array. 한줄해석 : 0을 뒤로 옮기되, 숫자 배열을 바꾸지마라. Example 1: Input: nums = [0,1,0,3,12] Output: [1,3,12,0,0] Example 2: Input: nums = [0] Output: [0] Co..
[leetcode 35][c++] search Insert Position
문제 : 알고있어야 할 점. "return low" 한다. 그 이유는. 배열에 [1,5] 가 들어있을경우, high = low +1 이고, mid = low 이다. 이걸 아래와 같이 나눠서 생각하면 각 변수의 인덱스는 l = 0, h = 1, m = 0 이다. case 1) target = 0 이면, target nums[mid] 면, low=mid+1 이므로, 1회 진행시 h,l,m이 같은 값을 가르킨다. [1, 5] ↑↑↑ h l m 다시 target이 5보다 작으므로, h=mid-1이고 [1, 5] ↑ ↑ h l 이 된다. case 3) ..
leetcode 56. merge-intervals [c++] [point :이차원벡터 정렬]
leetcode 56. merge-intervals 해설 원본 문제 : 더보기 더보기 Given an array of intervals where intervals[i] = [starti, endi], merge all overlapping intervals, and return an array of the non-overlapping intervals that cover all the intervals in the input. 문제해석요약 : 아래처럼 범위가 겹쳐지는게 있으면 합쳐서 하나로 만들어라 Input: intervals = [[1,3],[2,6],[8,10],[15,18]] Output: [[1,6],[8,10],[15,18]] Explanation: Since intervals [1,3] a..