Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit88dd14a

Browse files
add 1845
1 parent5dd6f6d commit88dd14a

File tree

2 files changed

+33
-1
lines changed

2 files changed

+33
-1
lines changed

‎README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ _If you like this project, please leave me a star._ ★
88

99
| # | Title | Solutions | Video | Difficulty | Tag
1010
|-----|----------------|---------------|--------|-------------|-------------
11-
|1844|[Replace All Digits with Characters](https://leetcode.com/problems/replace-all-digits-with-characters//)|[Solution](../master/src/main/java/com/fishercoder/solutions/_1844.java)||Easy|String|
11+
|1845|[Seat Reservation Manager](https://leetcode.com/problems/seat-reservation-manager/)|[Solution](../master/src/main/java/com/fishercoder/solutions/_1845.java)||Medium|Heap, Design|
12+
|1844|[Replace All Digits with Characters](https://leetcode.com/problems/replace-all-digits-with-characters/)|[Solution](../master/src/main/java/com/fishercoder/solutions/_1844.java)||Easy|String|
1213
|1837|[Sum of Digits in Base K](https://leetcode.com/problems/sum-of-digits-in-base-k/)|[Solution](../master/src/main/java/com/fishercoder/solutions/_1837.java)||Easy|Math, Bit Manipulation|
1314
|1833|[Maximum Ice Cream Bars](https://leetcode.com/problems/maximum-ice-cream-bars/)|[Solution](../master/src/main/java/com/fishercoder/solutions/_1833.java)||Medium|Array, Sort|
1415
|1832|[Check if the Sentence Is Pangram](https://leetcode.com/problems/check-if-the-sentence-is-pangram/)|[Solution](../master/src/main/java/com/fishercoder/solutions/_1832.java)||Easy|String|
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
packagecom.fishercoder.solutions;
2+
3+
publicclass_1845 {
4+
publicstaticclassSolution1 {
5+
classSeatManager {
6+
boolean[]seats;
7+
intnext;
8+
9+
publicSeatManager(intn) {
10+
seats =newboolean[n +1];
11+
next =1;
12+
}
13+
14+
publicintreserve() {
15+
seats[next] =true;
16+
inttmp =next;
17+
while (next <seats.length &&seats[next]) {
18+
next++;
19+
}
20+
returntmp;
21+
}
22+
23+
publicvoidunreserve(intseatNumber) {
24+
seats[seatNumber] =false;
25+
if (next >seatNumber) {
26+
next =seatNumber;
27+
}
28+
}
29+
}
30+
}
31+
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp