Skip to content

Commit 6dabd70

Browse files
committed
create 1603-design-parking-system.cs
1 parent 9014b37 commit 6dabd70

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

csharp/1603-design-parking-system.cs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
public class ParkingSystem
2+
{
3+
private int[] spaces;
4+
5+
public ParkingSystem(int big, int medium, int small)
6+
{
7+
spaces = [big, medium, small];
8+
}
9+
10+
public bool AddCar(int carType)
11+
{
12+
if (spaces[carType - 1] <= 0) return false;
13+
spaces[carType - 1] -= 1;
14+
return true;
15+
}
16+
}

0 commit comments

Comments
 (0)