is a comprehensive book on getting a job at a top tech company, while focuses on dev interviews and does this for PMs.
CareerCup's interview videos give you a real-life look at technical interviews. In these unscripted videos, watch how other candidates handle tough questions and how the interviewer thinks about their performance.
Most engineers make critical mistakes on their resumes -- we can fix your resume with our custom resume review service. And, we use fellow engineers as our resume reviewers, so you can be sure that we "get" what you're saying.
Our Mock Interviews will be conducted "in character" just like a real interview, and can focus on whatever topics you want. All our interviewers have worked for Microsoft, Google or Amazon, you know you'll get a true-to-life experience.
requirements:
- sandstormrobot March 11, 2015need to track # of visits of each page
need to track who visited the page & how many times
need to track each user activity of pages he visited and how many times
I think we need 2 data structures to solve this problem, one is geared toward pages and the other toward users
for pages, we could use max heap binary tree, the heap property is a pair of the total number of visits for this page along with the number of unique users visited this page.
each node will have list of users that visited this page and of course the page information itself.
this should answer first and second questions in log(n)
question 1:
which page was visited by exactly 2 users in day?
we start searching through the heap till we reach a pair that has count 2 of unique users.
question 2:
which page was visited by only one user exactly 2 times in a day?
we walk down the heap again looking for a pair that has only 1 as the unique number of users visited this page and 2 as the total times this page was visited.
question 3 is geared toward users, it would be not efficient if we used the same data structure, so we should (could) use hash table for users that would be something like:
hash table <User, List of Pair<Page, # of Visits of this Page>>
so with this data structure, question 3 we retrieve the list of pairs for user 3 and we look the pairs with # of Visits of this Page = 5 and get the page