TripAdvisor

  www.tripadvisor.com
Work in HR? Unlock Free Profile

TripAdvisor Senior Software Engineer Interview Question

I interviewed in Newton, MA and was asked:
"Design an alert system. You have 500,000 hotels you represent, and about 250,000 are visited each day. You want to track hotel page visits such that, if more than 10 visitors per a) 5 minutes, b) 1 hour, and c) 24 hours occur, then a (different for each time period) "alert" appears when someone visits one of those "hot" hotel pages. Don't worry about the UI part, just design the underlying alert system. Then optimize your solution for space."
Add Tags [?]
Answer

Part of a Senior Software Engineer Interview Review - one of 231 TripAdvisor Interview Reviews

Answers & Comments

0
of 0
votes

Not sure how good this is:

Create a hashMap of all the hotels with the key being hotel id and the value being an array of 3 interges (5 min hits, 1 hr hits, 24 hr hits).

For each request add one to each slot in the array. Then every 5 mins get all the hotels with 10+ count and reset the count to zero in the array

- llya on Nov 3, 2012
0
of 0
votes

How about create a hash map, key is the hotel id, value is a ArrayList which contains every visit time, so it is like ArrayList<visit time>,
when some one visit a hotel, find the number of elements in the ArrayList that is between current time and current time - 5 min, if larger than 10 then alert, if not, check the number of elements between current time and current time - 1 hr...

- Leo on Apr 7, 2013

To comment on this question, Sign In with Facebook or Sign Up

Tags are like keywords that help categorize interview questions that have something in common.