Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
create 1603-design-parking-system.cs
  • Loading branch information
NotADucc committed Oct 12, 2024
commit 6dabd70bc837f1e383f98a734454207d5349d208
16 changes: 16 additions & 0 deletions csharp/1603-design-parking-system.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
public class ParkingSystem
{
private int[] spaces;

public ParkingSystem(int big, int medium, int small)
{
spaces = [big, medium, small];
}

public bool AddCar(int carType)
{
if (spaces[carType - 1] <= 0) return false;
spaces[carType - 1] -= 1;
return true;
}
}