"This notebook was prepared by [Donne Martin](https://github.com/donnemartin). Source and license info is on [GitHub](https://github.com/donnemartin/system-design-primer-primer)."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Design a parking lot"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Constraints and assumptions\n",
"\n",
"* What types of vehicles should we support?\n",
" * Motorcycle, Car, Bus\n",
"* Does each vehicle type take up a different amount of parking spots?\n",
" * Yes\n",
" * Motorcycle spot -> Motorcycle\n",
" * Compact spot -> Motorcycle, Car\n",
" * Large spot -> Motorcycle, Car\n",
" * Bus can park if we have 5 consecutive \"large\" spots\n",
" return True if self.vehicle is None else False\n",
"\n",
" def can_fit_vehicle(self, vehicle):\n",
" if self.vehicle is not None:\n",
" return False\n",
" return vehicle.can_fit_in_spot(self)\n",
"\n",
" def park_vehicle(self, vehicle): # ...\n",
" def remove_vehicle(self): # ..."
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.4.3"
}
},
"nbformat": 4,
"nbformat_minor": 0
}
%% Cell type:markdown id: tags:
This notebook was prepared by [Donne Martin](https://github.com/donnemartin). Source and license info is on [GitHub](https://github.com/donnemartin/system-design-primer-primer).
%% Cell type:markdown id: tags:
# Design a parking lot
%% Cell type:markdown id: tags:
## Constraints and assumptions
* What types of vehicles should we support?
* Motorcycle, Car, Bus
* Does each vehicle type take up a different amount of parking spots?
* Yes
* Motorcycle spot -> Motorcycle
* Compact spot -> Motorcycle, Car
* Large spot -> Motorcycle, Car
* Bus can park if we have 5 consecutive "large" spots