Skip to content

Commit 2fcf6a5

Browse files
committed
update progress
1 parent d2771b5 commit 2fcf6a5

File tree

4 files changed

+80
-27
lines changed

4 files changed

+80
-27
lines changed

data/progress.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Progress
22

3+
# 2024-11-17
4+
- https://github.com/wisdompeak/LeetCode/tree/master?tab=readme-ov-file#two-pointers
5+
- (Two pointers for two sequences)
6+
37
# 2024-11-17
48
- https://github.com/yennanliu/CS_basics/blob/master/doc/Leetcode_company_frequency-master/Google%206months-%20LeetCode.pdf
59

data/progress.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1+
20241120: 986,80(todo),209(todo),283(todo),360(todo),713(todo),532(todo),611(todo)
12
20241117: 394
23
20241116: 833,950
3-
20241114: 80(todo),209(todo),283(todo),360(todo),713(todo),532(todo),611(todo)
44
20241110: 53,210,207
55
20241109: 444
66
20241108: 1188,130,855(again)

data/to_review.txt

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,41 @@
1+
2025-01-14 -> ['986,80(todo),209(todo),283(todo),360(todo),713(todo),532(todo),611(todo)']
12
2025-01-11 -> ['394']
23
2025-01-10 -> ['833,950']
3-
2025-01-08 -> ['80(todo),209(todo),283(todo),360(todo),713(todo),532(todo),611(todo)']
44
2025-01-04 -> ['53,210,207']
55
2025-01-03 -> ['444']
66
2025-01-02 -> ['1188,130,855(again)']
77
2024-12-28 -> ['900']
88
2024-12-27 -> ['26,27', '802,1197,26']
9+
2024-12-24 -> ['986,80(todo),209(todo),283(todo),360(todo),713(todo),532(todo),611(todo)']
910
2024-12-21 -> ['394', '855,846']
1011
2024-12-20 -> ['833,950', '932']
11-
2024-12-18 -> ['80(todo),209(todo),283(todo),360(todo),713(todo),532(todo),611(todo)', '951,792']
12+
2024-12-18 -> ['951,792']
1213
2024-12-14 -> ['53,210,207', '163,1048']
1314
2024-12-13 -> ['444', '298,729']
1415
2024-12-12 -> ['1188,130,855(again)', '1146']
16+
2024-12-11 -> ['986,80(todo),209(todo),283(todo),360(todo),713(todo),532(todo),611(todo)']
1517
2024-12-08 -> ['394', '737']
1618
2024-12-07 -> ['833,950', '900', '686,734,737']
1719
2024-12-06 -> ['26,27', '802,1197,26', '353']
18-
2024-12-05 -> ['80(todo),209(todo),283(todo),360(todo),713(todo),532(todo),611(todo)', '528,334']
19-
2024-12-03 -> ['1145']
20+
2024-12-05 -> ['528,334']
21+
2024-12-03 -> ['986,80(todo),209(todo),283(todo),360(todo),713(todo),532(todo),611(todo)', '1145']
2022
2024-12-01 -> ['53,210,207']
2123
2024-11-30 -> ['394', '444', '855,846', '1145,1219']
2224
2024-11-29 -> ['833,950', '1188,130,855(again)', '932']
23-
2024-11-27 -> ['80(todo),209(todo),283(todo),360(todo),713(todo),532(todo),611(todo)', '951,792', '524,221,889']
25+
2024-11-28 -> ['986,80(todo),209(todo),283(todo),360(todo),713(todo),532(todo),611(todo)']
26+
2024-11-27 -> ['951,792', '524,221,889']
2427
2024-11-26 -> ['743,889']
25-
2024-11-25 -> ['394', '837']
28+
2024-11-25 -> ['986,80(todo),209(todo),283(todo),360(todo),713(todo),532(todo),611(todo)', '394', '837']
2629
2024-11-24 -> ['833,950', '900']
27-
2024-11-23 -> ['53,210,207', '26,27', '802,1197,26', '163,1048', '981']
28-
2024-11-22 -> ['394', '80(todo),209(todo),283(todo),360(todo),713(todo),532(todo),611(todo)', '444', '298,729', '1087']
29-
2024-11-21 -> ['833,950', '1188,130,855(again)', '1146']
30+
2024-11-23 -> ['986,80(todo),209(todo),283(todo),360(todo),713(todo),532(todo),611(todo)', '53,210,207', '26,27', '802,1197,26', '163,1048', '981']
31+
2024-11-22 -> ['986,80(todo),209(todo),283(todo),360(todo),713(todo),532(todo),611(todo)', '394', '444', '298,729', '1087']
32+
2024-11-21 -> ['986,80(todo),209(todo),283(todo),360(todo),713(todo),532(todo),611(todo)', '833,950', '1188,130,855(again)', '1146']
3033
2024-11-20 -> ['394', '939']
31-
2024-11-19 -> ['394', '833,950', '80(todo),209(todo),283(todo),360(todo),713(todo),532(todo),611(todo)']
34+
2024-11-19 -> ['394', '833,950']
3235
2024-11-18 -> ['394', '833,950', '53,210,207', '430']
33-
2024-11-17 -> ['833,950', '80(todo),209(todo),283(todo),360(todo),713(todo),532(todo),611(todo)', '444', '855,846', '737', '363']
34-
2024-11-16 -> ['80(todo),209(todo),283(todo),360(todo),713(todo),532(todo),611(todo)', '1188,130,855(again)', '900', '932', '686,734,737', '1032,844,1011']
35-
2024-11-15 -> ['80(todo),209(todo),283(todo),360(todo),713(todo),532(todo),611(todo)', '53,210,207', '26,27', '802,1197,26', '353', '947']
36+
2024-11-17 -> ['833,950', '444', '855,846', '737', '363']
37+
2024-11-16 -> ['1188,130,855(again)', '900', '932', '686,734,737', '1032,844,1011']
38+
2024-11-15 -> ['53,210,207', '26,27', '802,1197,26', '353', '947']
3639
2024-11-14 -> ['444', '951,792', '528,334']
3740
2024-11-13 -> ['53,210,207', '1188,130,855(again)']
3841
2024-11-12 -> ['53,210,207', '444', '1145', '753']

leetcode_java/src/main/java/dev/workspace5.java

Lines changed: 59 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2088,7 +2088,7 @@ public int[] beautifulArray(int n) {
20882088

20892089
// LC 855
20902090
// https://leetcode.com/problems/exam-room/
2091-
// 4.28 pm - 4.40 pm
2091+
// 6.53 - 7.15 am
20922092
/**
20932093
* ep 1:
20942094
*
@@ -2112,33 +2112,79 @@ public int[] beautifulArray(int n) {
21122112
*
21132113
*/
21142114
class ExamRoom {
2115-
// attr
2115+
21162116
int[] seats;
2117-
PriorityQueue<Integer> pq;
2117+
int seated;
21182118

21192119
public ExamRoom(int n) {
2120-
this.seats = new int[n];
2121-
this.pq = new PriorityQueue();
2120+
seats = new int[n]; // init val ??
2121+
seated = 0;
21222122
}
21232123

21242124
public int seat() {
2125-
// if not one seated, select the 0 idx seat
2126-
if (this.pq.isEmpty()){
2127-
this.seats[0] = 0;
2125+
//return 0;
2126+
if (seated == 0){
2127+
seats[0] = 1;
2128+
seated += 1;
21282129
return 0;
21292130
}
21302131

2131-
// TODO : fix
2132-
return 0;
2132+
// get "to compare" seat
2133+
int idx = -1;
2134+
for (int j = 0; j < seats.length; j++){
2135+
// get distance
2136+
//int dis = 1;
2137+
if (seats[j] == 0){
2138+
idx = j;
2139+
break;
2140+
}
2141+
}
2142+
2143+
int toPutIdx = -1;
2144+
// find "maximizes the distance to the closest person"
2145+
for (int i = seats.length; i > 0; i--){
2146+
if (seats[i] != 0){
2147+
toPutIdx = i;
2148+
break;
2149+
}
2150+
}
2151+
return toPutIdx; // ???
21332152
}
21342153

21352154
public void leave(int p) {
2136-
2137-
this.seats[p] = 0;
2155+
seats[p] = 0;
2156+
seated -= 1;
21382157
}
2139-
21402158
}
21412159

2160+
// class ExamRoom {
2161+
// // attr
2162+
// int[] seats;
2163+
// PriorityQueue<Integer> pq;
2164+
//
2165+
// public ExamRoom(int n) {
2166+
// this.seats = new int[n];
2167+
// this.pq = new PriorityQueue();
2168+
// }
2169+
//
2170+
// public int seat() {
2171+
// // if not one seated, select the 0 idx seat
2172+
// if (this.pq.isEmpty()){
2173+
// this.seats[0] = 0;
2174+
// return 0;
2175+
// }
2176+
//
2177+
// // TODO : fix
2178+
// return 0;
2179+
// }
2180+
//
2181+
// public void leave(int p) {
2182+
//
2183+
// this.seats[p] = 0;
2184+
// }
2185+
//
2186+
// }
2187+
21422188
// LC 846
21432189
// https://leetcode.com/problems/hand-of-straights/
21442190
// 5.29 pm - 5.45 pm

0 commit comments

Comments
 (0)