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

Commit9c9d7a1

Browse files
add 1603
1 parenta49e1d1 commit9c9d7a1

File tree

2 files changed

+41
-0
lines changed

2 files changed

+41
-0
lines changed

‎README.md

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

99
| # | Title | Solutions | Video | Difficulty | Tag
1010
|-----|----------------|---------------|--------|-------------|-------------
11+
|1603|[Design Parking System](https://leetcode.com/problems/design-parking-system/)|[Solution](../master/src/main/java/com/fishercoder/solutions/_1603.java)||Easy|Design|
1112
|1601|[Maximum Number of Achievable Transfer Requests](https://leetcode.com/problems/maximum-number-of-achievable-transfer-requests/)|[Solution](../master/src/main/java/com/fishercoder/solutions/_1601.java)||Hard|Backtracking|
1213
|1598|[Crawler Log Folder](https://leetcode.com/problems/crawler-log-folder/)|[Solution](../master/src/main/java/com/fishercoder/solutions/_1598.java)||Easy|Stack|
1314
|1592|[Rearrange Spaces Between Words](https://leetcode.com/problems/rearrange-spaces-between-words/)|[Solution](../master/src/main/java/com/fishercoder/solutions/_1592.java)||Easy|String|
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
packagecom.fishercoder.solutions;
2+
3+
publicclass_1603 {
4+
publicstaticclassSolution1 {
5+
classParkingSystem {
6+
int[]slots =newint[3];
7+
8+
publicParkingSystem(intbig,intmedium,intsmall) {
9+
slots[0] =big;
10+
slots[1] =medium;
11+
slots[2] =small;
12+
}
13+
14+
publicbooleanaddCar(intcarType) {
15+
if (carType ==1) {
16+
if (slots[0] >0) {
17+
slots[0]--;
18+
returntrue;
19+
}else {
20+
returnfalse;
21+
}
22+
}elseif (carType ==2) {
23+
if (slots[1] >0) {
24+
slots[1]--;
25+
returntrue;
26+
}else {
27+
returnfalse;
28+
}
29+
}else {
30+
if (slots[2] >0) {
31+
slots[2]--;
32+
returntrue;
33+
}else {
34+
returnfalse;
35+
}
36+
}
37+
}
38+
}
39+
}
40+
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp