Skip to content

Commit

Permalink
update 252 java, progress
Browse files Browse the repository at this point in the history
  • Loading branch information
yennanliu committed Mar 10, 2024
1 parent e727f16 commit b0a74ae
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 13 deletions.
2 changes: 1 addition & 1 deletion data/progress.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
20240310: 213,217,226,230,235,238,242
20240310: 213,217,226,230,235,238,242,252
20240309: 207(again!!!),208,211(again),212
20240308: 152,153(again),190,191,198,200,206(again)
20240307: 139(again),141,143(again)
Expand Down
18 changes: 9 additions & 9 deletions data/to_review.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
2024-05-04 -> ['213,217,226,230,235,238,242']
2024-05-04 -> ['213,217,226,230,235,238,242,252']
2024-05-03 -> ['207(again!!!),208,211(again),212']
2024-05-02 -> ['152,153(again),190,191,198,200,206(again)']
2024-05-01 -> ['139(again),141,143(again)']
Expand All @@ -9,7 +9,7 @@
2024-04-24 -> ['39,48(again),49,53,54']
2024-04-23 -> ['20,21,23,33(again)']
2024-04-22 -> ['1,3,5,4,19']
2024-04-13 -> ['213,217,226,230,235,238,242']
2024-04-13 -> ['213,217,226,230,235,238,242,252']
2024-04-12 -> ['207(again!!!),208,211(again),212']
2024-04-11 -> ['152,153(again),190,191,198,200,206(again)']
2024-04-10 -> ['139(again),141,143(again)']
Expand All @@ -20,27 +20,27 @@
2024-04-03 -> ['39,48(again),49,53,54']
2024-04-02 -> ['20,21,23,33(again)']
2024-04-01 -> ['1,3,5,4,19']
2024-03-31 -> ['213,217,226,230,235,238,242']
2024-03-31 -> ['213,217,226,230,235,238,242,252']
2024-03-30 -> ['207(again!!!),208,211(again),212']
2024-03-29 -> ['152,153(again),190,191,198,200,206(again)']
2024-03-28 -> ['139(again),141,143(again)']
2024-03-27 -> ['121,124(again),125,128,133(again)']
2024-03-26 -> ['100,102,104,105(again)']
2024-03-25 -> ['73,76,79(again),91,25']
2024-03-24 -> ['55(again),56,62,70']
2024-03-23 -> ['213,217,226,230,235,238,242']
2024-03-23 -> ['213,217,226,230,235,238,242,252']
2024-03-22 -> ['207(again!!!),208,211(again),212']
2024-03-21 -> ['152,153(again),190,191,198,200,206(again)', '39,48(again),49,53,54']
2024-03-20 -> ['139(again),141,143(again)', '20,21,23,33(again)']
2024-03-19 -> ['121,124(again),125,128,133(again)', '1,3,5,4,19']
2024-03-18 -> ['213,217,226,230,235,238,242', '100,102,104,105(again)']
2024-03-18 -> ['213,217,226,230,235,238,242,252', '100,102,104,105(again)']
2024-03-17 -> ['207(again!!!),208,211(again),212', '73,76,79(again),91,25']
2024-03-16 -> ['152,153(again),190,191,198,200,206(again)', '55(again),56,62,70']
2024-03-15 -> ['213,217,226,230,235,238,242', '139(again),141,143(again)']
2024-03-15 -> ['213,217,226,230,235,238,242,252', '139(again),141,143(again)']
2024-03-14 -> ['207(again!!!),208,211(again),212', '121,124(again),125,128,133(again)']
2024-03-13 -> ['213,217,226,230,235,238,242', '152,153(again),190,191,198,200,206(again)', '100,102,104,105(again)', '39,48(again),49,53,54']
2024-03-12 -> ['213,217,226,230,235,238,242', '207(again!!!),208,211(again),212', '139(again),141,143(again)', '73,76,79(again),91,25', '20,21,23,33(again)']
2024-03-11 -> ['213,217,226,230,235,238,242', '207(again!!!),208,211(again),212', '152,153(again),190,191,198,200,206(again)', '121,124(again),125,128,133(again)', '55(again),56,62,70', '1,3,5,4,19']
2024-03-13 -> ['213,217,226,230,235,238,242,252', '152,153(again),190,191,198,200,206(again)', '100,102,104,105(again)', '39,48(again),49,53,54']
2024-03-12 -> ['213,217,226,230,235,238,242,252', '207(again!!!),208,211(again),212', '139(again),141,143(again)', '73,76,79(again),91,25', '20,21,23,33(again)']
2024-03-11 -> ['213,217,226,230,235,238,242,252', '207(again!!!),208,211(again),212', '152,153(again),190,191,198,200,206(again)', '121,124(again),125,128,133(again)', '55(again),56,62,70', '1,3,5,4,19']
2024-03-10 -> ['207(again!!!),208,211(again),212', '152,153(again),190,191,198,200,206(again)', '139(again),141,143(again)', '100,102,104,105(again)']
2024-03-09 -> ['152,153(again),190,191,198,200,206(again)', '139(again),141,143(again)', '121,124(again),125,128,133(again)', '73,76,79(again),91,25']
2024-03-08 -> ['139(again),141,143(again)', '121,124(again),125,128,133(again)', '100,102,104,105(again)', '55(again),56,62,70', '39,48(again),49,53,54']
Expand Down
21 changes: 19 additions & 2 deletions leetcode_java/src/main/java/LeetCodeJava/Sort/MeetingRooms.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,24 @@

public class MeetingRooms {

// V0
// IDEA : SORT
// https://github.com/yennanliu/CS_basics/blob/master/leetcode_python/Sort/meeting-rooms.py
public boolean canAttendMeetings(int[][] intervals) {
// SORT ON 1st element (idx = 0)
Arrays.sort(intervals, (a, b) -> Integer.compare(a[0], b[0]));
// NOTE !!! start from idx=1
for (int i = 1; i < intervals.length; i++) {
if (intervals[i-1][1] > intervals[i][0]) {
return false;
}
}
return true;
}

// V1
// IDEA : SORT
public boolean canAttendMeetings_(int[][] intervals) {

// sort
//Arrays.sort(intervals, Comparator.comparingInt((x, y) -> x[0] - y[0]).reversed());
Expand Down Expand Up @@ -38,11 +55,11 @@ public boolean canAttendMeetings(int[][] intervals) {
return true;
}

// V1
// V2
// IDEA : BRUTE FORCE
// https://leetcode.com/problems/meeting-rooms/editorial/

// V1
// V3
// IDEA : SORTING
// https://leetcode.com/problems/meeting-rooms/editorial/
public boolean canAttendMeetings_2(int[][] intervals) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,5 +78,5 @@ public boolean isAnagram_2(String s, String t) {

return true;
}

}

0 comments on commit b0a74ae

Please sign in to comment.