18. Design a Parking Lot In Swift

In a technical interview, your goal is to design the algorithms and data structures needed to manage the main functions of a parking lot. For this exercise, assume your lot has spaces for common spaces as well as reserved spots:

 
 

Hints

  • How will your system describe the concept of a parking space?

  • What kind of structure(s) will represent multiple parking spaces at your lot?

  • How will you determine if your entire parking lot is at (or nearing) capacity?

  • What will be the process for making a parking reservation?

  • If reserved parking is at capacity, will customers be able to park in a regular spot?

  • Will your lot have pricing discounts based on when someone enters the garage or makes a reservation? (date or time)