Skip to content

Instantly share code, notes, and snippets.

@quarterdome
Last active September 12, 2016 22:08
Show Gist options
  • Save quarterdome/99a3cd82d01d11628731 to your computer and use it in GitHub Desktop.
Save quarterdome/99a3cd82d01d11628731 to your computer and use it in GitHub Desktop.
Apartment List Coding Problem: Snippets
Welcome to Apartment List code test!
For an apartment search we need to generate description snippets that match the search query. For example, lets assume we have the apartment with the following description:
"Our luxury loft-style apartments were constructed as condominiums, so your new residence will have: Solid floors and walls (this will be the quietest apartment you've EVER lived in); Premium stainless steel designer appliances; Distinctive accent walls and hardwood flooring; A kitchen that most chefs would drool over with easy to clean gas stove and countertops; Walk in closets with built in storage; Full size washer and dryer in each apartment home. In addition, all residents will enjoy use of our top-notch amenities, including reserved parking, cutting-edge fitness center, wireless internet cafe/business center, and rooftop lounge to soak up the sun!"
Lets consider a user searching for "designer kitchen". In this case, a good snippet would be something like this:
"Premium stainless steel designer appliances; Distinctive accent walls and hardwood flooring; A kitchen that most chefs would drool over with easy to clean gas stove and countertops;"
For this question you will write a function that finds the most relevant snippet for a document. It doesn't have to be great, but the more relevant it is the better. We understand that definition of "relevant snippet" is open ended, you need to decide what matters to you, explain you choices, and provide a clean implementation.
The solution can be in any language, we would do it in Ruby but you do not have to. Put your native source files, together with README, tests, and any other support files the code needs into a GitHub project, and email us the URL. Please make sure to write the code that you would be proud of committing to source control system in professional environment. We would like to hear back from you in the next couple days. Most applicants report spending anywhere between 2 and 5 hours on this problem.
The function should have a signature similar to the following:
##
# args:
# document - string containing apartment description
# query - user search query string
#
# returns:
# the most relevant snippet as string
def generate_snippet(document, query)
...
end
Thanks a lot for your time!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment