Answer: Philips Hiring Challenge | On-Campus OA (2022) | Design Parking System
Answer · Posted Jun 2026
Approach Store the available parking spaces for each car type. Whenever a car arrives: Check if a parking slot of that type is available. If available, decrease the count and return true. Otherwise return false. Strategy Store the parking capacities in an array. For each addCar() call: Check whether spaces are available. If yes, decrement the count. Return the appropriate boolean result. Java Code class ParkingSystem { private int[] spaces; public ParkingSystem(int big, int medium, int small) { spaces = ...
The full answer & interview discussion are available to premium members.
Log in Create a free account