Amazon Interview Question for Software Engineer / Developers






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

process per day data at a time and create a table
customer id | page count | toggle bit
day 1: create customer -> page count data -> toggle = 0
day 2: update day 1 table with customer -> page count
if customer[hit] -> update page count, and toggle = !toggle,
so toggle == 1 for 2 day visitors.
day 3: do same as above, update data, toggle bit for customer hits

Go through customer table and output customers with toggle == 1

Can be done with map-reduce, with reduce doing the toggling.

- Anonymous August 02, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Lets say that we have two tables:
+ All visited pages, with a unique id for each page.
+ Customer table with days visited for each customer, with information on all pages visited

struct pages_table {
	struct page_info[MAX_PAGES];
};

struct day {
	int day[MAX_PAGE_CNT];	
	int page_count;		
};

struct cust {
	int cust_id;
	int num_days_visited;
	struct day1;
	struct day2;
	struct day3;
};

Collect all customers with num_days_visited == 2.

- LSK August 04, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

<pre lang="whitespace" line="1" title="CodeMonkey62719" class="run-this">-- Assume that we have access to canonicalized log file with three fields (user, page, date).
A = load 'visits.log' as (user:chararray, page:chararray, date:chararray);

-- Group tuples by user.
B = group A by user;

-- For each user, count distinct pages viewed and dates of visit.
C = foreach B {
pages = distinct(A.page);
dates = distinct(A.date);
generate group as user,
COUNT(pages) as pages,
COUNT(dates) as dates;
};

-- Apply filter to each user's aggregates.
D = filter C by pages > 2 and dates == 2;

-- Project out columns that are no longer needed.
E = foreach D generate user;

-- Dump out all the users who have passed the filter conditions.
dump E;
</pre><pre title="CodeMonkey62719" input="yes">
</pre>

- Anonymous September 04, 2010 | Flag Reply


Add a Comment
Name:

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

Books

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

Videos

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