Java || Array + Design || 6ms || beats 99.90% || addCar - O(1)
\n\tint big, medium, small;\n\tint[] parkingLot, pointer;\n\tint ptr1, ptr2, ptr3;\n\n\t// O(1) O(1)\n\tpublic ParkingSystem(int big, int medium, int small) {\n
\n\tint big, medium, small;\n\tint[] parkingLot, pointer;\n\tint ptr1, ptr2, ptr3;\n\n\t// O(1) O(1)\n\tpublic ParkingSystem(int big, int medium, int small) {\n\t\tthis.big = big;\n\t\tthis.medium = medium;\n\t\tthis.small = small;\n\t\tthis.pointer = new int[4];\n\t\tparkingLot = new int[4];\n\t\tparkingLot[1] = this.big;\n\t\tparkingLot[2] = this.medium;\n\t\tparkingLot[3] = this.small;\n\t\tptr1 = ptr2 = ptr3 = -1;\n\t\tpointer[1] = ptr1;\n\t\tpointer[2] = ptr2;\n\t\tpointer[3] = ptr3;\n\t}\n\n\t// O(1) O(1)\n\tpublic boolean addCar(int carType) {\n\n\t\tint lotType = parkingLot[carType];\n\t\tint ptr = pointer[carType];\n\n\t\tif (ptr == lotType - 1)\n\t\t\treturn false;\n\n\t\tpointer[carType]++;\n\t\treturn true;\n\t}
[]