This is a verified interview question from Box-fusion. Candidates reporting seeing this problem in recent Online Assessments (OAs) and onsite rounds. Mastering "Parking Lot Fee Calculator - Box Fusion" covers key patterns like Other.
"You are working as a developer for a chain of parking lots. Your task is to program the payment machine to calculate the amount of money owed based on the time a vehicle was parked. The time is passed to you as hours, minutes as in integer format. Write a function calculateParkingLot that takes the hours and minutes as input and returns the parking fee to be paid based on the following criteria: - If the time is less than or equal to 15 minutes, no charge is incurred. - If the time is more than 15 minutes and less than or equal to 2 hours, the fee is $5. - If the time is more than 2 hours and less than or equal to 5 hours, the fee is $10. - If the time is more than 5 hours, the fee is $10 plus $1 for each additional full hour after 5 hours have passed. Note: - Hours should be non-negative. - Minutes should be between 0 and 59 (inclusive). - Return -1 in case of an invalid hour value. - Return -2 in case of an invalid minute value."
Join thousands of developers practicing for Box-fusion.