Interview Question
Software Engineer / DevelopersCountry: India
Interview Type: Written Test
continue to the above problem;
Each hotel has specific rates for weekend and weekdays. x charges $100 for regular customers on weekdays and $120 on weekends While it is $90 for rewardee on weekdays and $95 on weekends. While z charges $195 for regular customers on weekdays and $150 on weekends. While its $120 for rewardee on weekdays and $90 on weekends. Now when the customer requests for a particular detail you need to find which hotel would yield the customer profit. In case of tie between hotels compare the ratings and provide the result.
I don't understand the question. Is this a question about getting the best price for the customer, or the max profit for the hotel, or what exactly?
Consider each hotel as struct of 5 attributresstruct hotel{ int star; int regular_weekdays; int regular_weekends; int rewardee_weekdays; int rewardee_weekends;};Now check each hotel and maintain the lowest cost hotel. In case of tie with the lowest maitained hotel check if the current hotel's star is more thhan the maintained one, if it is then the replace the maintained hotel with current hotel.
- maverick October 03, 2012