May 2009 - May 2017 论坛八周年-你的足迹,我的骄傲



查看: 982|回复: 0

[找工就业] tripadvisor 面经

[复制链接] |试试Instant~ |关注本帖
基德不爱吃鱼 发表于 2015-5-2 04:53:26 | 显示全部楼层 |阅读模式

2015(4-6月)-[13]EE硕士+fresh grad 无实习/全职 - 网上海投| 码农类全职@TripAdvisorfresh grad应届毕业生


您需要 登录 才可以下载或查看,没有帐号?获取更多干活,快来注册

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.
The types of deals are as follows:
    rebate : a straight discount off the total price of the stay
    rebate_3plus : a straight discount off the total price when the duration of stay is >= 3
    pct : a percentage discount off the total price of the stay
The deals data file will be a comma-separated file (CSV) in the following format:
Hotel Commonwealth,250,$50 off your stay 3 nights or more,-50,rebate_3plus,2014-06-01,2014-07-31
Hotel Commonwealth,250,5% off your stay,-5,pct,014-06-01,2014-06-15
Hotel Commonwealth,250,$25 off your stay,-25,rebate,2014-07-07,2014-07-31   

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:
> BestHotelDeal ./deals.csv “Hotel Commonwealth” 2014-06-30 3
Any errors resulting from bad parameters and/or invalid deal file should be handled gracefully, with informative feedback to the user.
> BestHotelDeal ./deals.csv  "Hotel Commonwealth" 2014-06-30 3
> $50 off your stay 3 nights or more
> BestHotelDeal ./deals.csv  "Hotel ABC" 2014-06-30 1
> 5% off your stay
> BestHotelDeal ./deals.csv  "Hotel ABC" 2014-06-30 2
> no deal available


  • · TA|主题: 9, 订阅: 0



一亩三分地推荐上一条 /5 下一条

手机版|小黑屋|一亩三分地论坛声明 ( 沪ICP备11015994号 )

custom counter

GMT+8, 2017-5-26 10:41

Powered by Discuz! X3

© 2001-2013 Comsenz Inc. Design By HUXTeam

快速回复 返回顶部 返回列表