일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | ||||
4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 26 | 27 | 28 | 29 | 30 | 31 |
- SeongSeobDang
- BFS
- Hamming weight
- 자고 싶다
- LeetCode #릿코드 #좋은 하루 되세요 #Have a nice day
- SSAFY IM/A
- I am Korean
- 아자아자 화이팅
- 모르고리즘
- 우유가 옆으로 넘어지면 아야
- 텐션 업 10기 화이팅
- 텐션 업 10기!
- Have a good day :)
- 우유가옆으로넘어지면아야
- 우유아야
- HAVE A GOOD DAY
- 코로나 싫어요
- 자료구조
- Have a nice day.
- 수학
- have a nice day
- SSAFY 10기 화이팅
- 네트워크
- Java 환경 설정
- SSAFY 테스트
- DP
- SSAFY 화이팅
- amazon
- DFS
- Today
- Total
Hope Everyone Is Happy
[Medium] 253. Meeting Rooms II (Java) 본문
[Medium] 253. Meeting Rooms II (Java)
J 크 2023. 11. 27. 11:25https://leetcode.com/problems/meeting-rooms-ii/description/
Meeting Rooms II - LeetCode
Can you solve this real interview question? Meeting Rooms II - 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
long time no see~
※ Question Summary
▶ Input : An array of meeting time intervals (2D array where some[i] = [start(i), end(i)])
▶ Output : Return the minimum of conference rooms required
◈ Input - 1
[[0,30],[5,10],[15,20]]
◈ Output - 1
2
◈ Input - 2
[[0,30],[5,10],[15,20]]
◈ Output - 2
1
◎ HOW TO SOLVE IT
▶ Constraints : 1 <= intervals.length <= 10^4 && 0 <= start(i) < end(i) <= 10^6
▶ The result must be greater than 0.
▶ Make an 1Darray (size of 10^6) for counting the meeting times
▶ Update the count for each interval [start(i), end(i)] in the input array.
▶ Return the maximum count from the counting array
class Solution {
public int minMeetingRooms(int[][] intervals) {
int[] narrCounts = new int[1000000];
int nMax = 1;
for(int i = 0; i < intervals.length; i++) {
for(int j = intervals[i][0]; j < intervals[i][1]; j++) {
narrCounts[j]++;
}
}
for(int i = 0; i < narrCounts.length; i++)
nMax = Math.max(nMax, narrCounts[i]);
return nMax;
}
}
영어 재밌네요
'※ 릿코드 ( LeetCode ) > [Java] 문제 풀이 ( Solve the problems)' 카테고리의 다른 글
[Medium] 366. Find Leaves of Binary Tree (Java) (0) | 2023.12.04 |
---|---|
[Easy] 191. Number of 1Bits (Java) (0) | 2023.11.29 |
[Hard] 329. Longest Increasing Path in a Matrix (Java) (0) | 2023.11.28 |
Pascal's Triangle (Java) (4) | 2023.07.18 |
Diagonal Traverse (Java) (0) | 2023.07.17 |