Amazon Interview Question
Software Engineer / DevelopersCountry: United States
Interview Type: In-Person
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.
You'd want some kind of tree structure for querying by geographic region. Since you can query by regions like state or drill down to state + city + street, a hierarchical representation like a tree is appropriate. Give the tree a node for each state, give each state node a child node for each city, give each city node a child node for each street, and then give each street a Set of Names. That way, it's very easy to satisfy any queries of the form "given any State or State + City or State + City + Street return all names". Just go to the appropriate level of the tree and recursively traverse all the subtrees from there, getting the union of all the Sets of names encountered (you don't have to check for duplicates since the sets are disjoint).
- eugene.yarovoi April 24, 2012For querying by name, a hashtable, tree, or B-tree if you're trying to save space is reasonable. This datastructure would establish an efficient map between names and records (a record contains the name, state, city, and street; it's basically a database row).