Amazon Interview Question for SDE1s

Country: United States
Interview Type: In-Person

Comment hidden because of low score. Click to expand.
of 0 vote

Firstly, need to ask interviewer to clarify:
- # of log entries/day, # of pages and # of users? can the data fit into a traditional DB or requires distributed storage. I assume the analyzed results can be loaded into an RDBMS.
- is this real-time analysis or can we use a Hadoop job to ETL? I assume ETL is allowed.
- should we optimize for query performance or write performance? I assume query performance is more critical.

The solution is to write raw log data to HDFS, using Apache Flume to support multiple data centers. Use Hadoop job to analyze the raw data and load results into an RDBMS for query.

In RDBMS, to support the first two queries, we can use a table with columns "page, user-count, visit-count". For third query, we can create a table with "page, user-id, count".

- lngbrc February 05, 2015 | Flag Reply
Comment hidden because of low score. Click to expand.
of 0 vote

If it comes to Java - you can represent using following class and process the Queries from the pool of page objects.

public class page{
String url;
String User;
int NoOfTimesVisited;


All queries can also converted to Hadoop MR solutions,
Mapper Key - URL
Mapper Value - UserName (emit 1 if you are intrested to count numbers of Users on URL)

- pk February 05, 2015 | Flag Reply

Add a Comment

Writing Code? Surround your code with {{{ and }}} to preserve whitespace.


is a comprehensive book on getting a job at a top tech company, while focuses on dev interviews and does this for PMs.

Learn More


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.

Learn More

Resume Review

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.

Learn More

Mock Interviews

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.

Learn More