注册一亩三分地论坛,查看更多干货!
您需要 登录 才可以下载或查看附件。没有帐号?注册账号
x
我基础比较差。。实在想不到什么技巧
[size=12.8000001907349px]Given a data file containing hotel deals, write an app to find the best applicable deal for the user and return the promo_txt for the deal. You will need to consider the type of deal, valid dates, hotel name, and edge cases. If no deal applies you will return “no deals available”. You may assume the entire deals file fits in memory. You may use Java, C++, C#, or Python for your solution with the standard libraries at your disposal. [size=12.8000001907349px]The types of deals are as follows: [size=12.8000001907349px] rebate : a straight discount off the total price of the stay [size=12.8000001907349px] rebate_3plus : a straight discount off the total price when the duration of stay is >= 3 [size=12.8000001907349px] pct : a percentage discount off the total price of the stay [size=12.8000001907349px]The deals data file will be a comma-separated file (CSV) in the following format: [size=12.8000001907349px]hotel_name,nightly_rate,promo_txt,deal_value,deal_type,start_date,end_date [size=12.8000001907349px]Hotel Commonwealth,250,$50 off your stay 3 nights or more,-50,rebate_3plus,2015-06-01,2015-07-31 [size=12.8000001907349px]Hotel Commonwealth,250,5% off your stay,-5,pct,014-06-01,2015-06-15 [size=12.8000001907349px]Hotel Commonwealth,250,$25 off your stay,-25,rebate,2015-07-07,2015-07-31
[size=12.8000001907349px]The input to your application will be the path to the deal file, the hotel name, check in date, and number of nights stay. For example: [size=12.8000001907349px]> BestHotelDeal ./deals.csv “Hotel Commonwealth” 2015-06-30 3 [size=12.8000001907349px]Any errors resulting from bad parameters and/or invalid deal file should be handled gracefully, with informative feedback to the user. [size=12.8000001907349px]Examples: [size=12.8000001907349px]> BestHotelDeal ./deals.csv "Hotel Commonwealth" 2015-06-30 3 [size=12.8000001907349px]> $50 off your stay 3 nights or more [size=12.8000001907349px]> BestHotelDeal ./deals.csv "Hotel ABC" 2015-06-30 1 [size=12.8000001907349px]> 5% off your stay [size=12.8000001907349px]> BestHotelDeal ./deals.csv "Hotel ABC" 2015-06-30 2 [size=12.8000001907349px]> no deal available
|