Simple solution using Switch
\n# Approach\n\n---\n\nInitialize all parking spaces.\nCheck if it there is room in the corresponding parking space.\nIf there is, we decrement it by 1 to indic
\n# Approach\n\n---\n\nInitialize all `parking spaces`.\nCheck if it there is room in the corresponding parking space.\nIf there is, we decrement it by `1` to indicate one less parking spot is available and return `true` otherwise we return `false`\n\n---\n\n# AWESOME IMAGE!\n\n---\n\n![Screenshot 2023-10-02 131803.png](https://assets.leetcode.com/users/images/32059569-2d16-473a-84ea-c62d83115bc0_1698181145.9756258.png)\n\n# Code\n```C# []\npublic class ParkingSystem {\n    int bigSpace;\n    int midSpace;\n    int smallSpace;\n\n    public ParkingSystem(int big, int medium, int small) {\n        this.bigSpace = big;\n        this.midSpace = medium;\n        this.smallSpace = small;\n    }\n\n    public bool AddCar(int carType) {\n        switch (carType) {\n            case 3:\n                if (this.smallSpace != 0) {\n                    this.smallSpace--;\n                    return true;\n                } else {\n                    return false;\n                }\n            case 2:\n                if (this.midSpace != 0) {\n                    this.midSpace--;\n                    return true;\n                } else {\n                    return false;\n                }\n            case 1:\n                if (this.bigSpace != 0) {\n                    this.bigSpace--;\n                    return true;\n                } else {\n                    return false;\n                }\n            default:\n                return false;\n        }\n    }\n}\n```\n```C++ []\n#include <iostream>\n\nclass ParkingSystem {\nprivate:\n    int bigSpace;\n    int midSpace;\n    int smallSpace;\n\npublic:\n    ParkingSystem(int big, int medium, int small) {\n        bigSpace = big;\n        midSpace = medium;\n        smallSpace = small;\n    }\n\n    bool addCar(int carType) {\n        switch (carType) {\n            case 3:\n                if (smallSpace > 0) {\n                    smallSpace--;\n                    return true;\n                } else {\n                    return false;\n                }\n            case 2:\n                if (midSpace > 0) {\n                    midSpace--;\n                    return true;\n                } else {\n                    return false;\n                }\n            case 1:\n                if (bigSpace > 0) {\n                    bigSpace--;\n                    return true;\n                } else {\n                    return false;\n                }\n            default:\n                return false;\n        }\n    }\n};\n```\n```Python []\nclass ParkingSystem:\n    def __init__(self, big, medium, small):\n        self.bigSpace = big\n        self.midSpace = medium\n        self.smallSpace = small\n\n    def addCar(self, carType):\n        if carType == 3:\n            if self.smallSpace > 0:\n                self.smallSpace -= 1\n                return True\n            else:\n                return False\n        elif carType == 2:\n            if self.midSpace > 0:\n                self.midSpace -= 1\n                return True\n            else:\n                return False\n        elif carType == 1:\n            if self.bigSpace > 0:\n                self.bigSpace -= 1\n                return True\n            else:\n                return False\n        else:\n            return False\n```\n
['Python', 'C++', 'C#']