Beats 100%😍 || Easy Approach🔥|| 0ms✅|| Simple Explanation👍
Intuition\n Describe your first thoughts on how to solve this problem. \n- Just Create a private class variable i.e. an array of int which will hold Car Types a
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n- Just Create a private class variable i.e. an array of int which will hold **Car Types** and be only accesed by our class methods to access it. \n\n- Then we add the input values to it from the constructor.\n\n- At last we check the values from the array created from constructor and then return the bool value.\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\nThe most basic approach , we do what we just read and implement it\n\n1. We are creating an array of size of **3** i.e. `private int slots[] = new int[3];` as a class variable to be accesed by the methods.\n\n  - Or, we can just initialize it and declare it later down.\n  \n         private int arr[];\n\n\n2. For `ParkingSystem(int big, int medium, int small)` constructor , we input thses value to our created array.\n\n```\n    slots[0] = big;\n    slots[1] = medium;\n    slots[2] = small;\n```\n- Or, we can say to be declaring size and giving input ar realtime.\n\n      arr = new int[]{big,medium,small};\n\n3. For `addCar(int carType)` method :  \n    - We check if the input **carType** has value greater than 0. i.e. `if(slots[carType-1]>0)` \n    - Then we decrement that slot value by 1 and return **true** i.e \n     ```\n        slots[carType-1]--;\n        return true;\n    ```\n    - **Else** we return **false**.\n\n# Complexity\n- Time complexity: $$O(1)$$\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:$$O(1)$$\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n> Do post your **doubts** in the Comment Section.\uD83D\uDC47\n\n# Code\n\n#### Simple  to understand\n\n```java []\nclass ParkingSystem {\n    private int slots[] = new int[3];\n    public ParkingSystem(int big, int medium, int small) {\n        slots[0] = big;\n        slots[1] = medium;\n        slots[2] = small;\n    }\n    \n    public boolean addCar(int carType) {\n        if(slots[carType-1]>0)\n        {   \n            slots[carType-1]--;\n            return true;\n            \n        }\n        return false;\n    }\n}\n```\n\n#### Shorter\n\n```java []\nclass ParkingSystem {\n    private int arr[];\n    public ParkingSystem(int big, int medium, int small) {\n        arr = new int[]{big,medium,small};\n    }\n    \n    public boolean addCar(int carType) {\n        if(arr[carType-1]>0)\n        {   \n            arr[carType-1]--;\n            return true;\n        }\n        return false;\n    }\n}\n```\n\n![please-upvote-and.jpg](https://assets.leetcode.com/users/images/db330b30-5057-49a2-8d34-adec07dd6b77_1685353411.6302762.jpeg)\n
['Array', 'Design', 'Simulation', 'Counting', 'Java']