Giter Club home page Giter Club logo

airbnb-property-search's Introduction

You will be provided with availability and pricing data for a set of rental properties.  Your program will determine the cheapest properties for a given date range in a specific geographic area.

You will read input from STDIN and print output to STDOUT.

Input:

The input is in CSV format with three sections of data.  "Properties", "Dates", and "Searches".  Each section will begin with a single line labeling the section followed by a number of lines with that section's data.

Here is a description of each section and the data columns in contains.

"Properties" - identifies possible properties for rent

• property_id - an integer
• lat - a float
• lng - a float
• nightly_price - the standard nightly price; an integer in dollars (no cents)

"Dates" - specifies dates when properties are unavailable, or when the nightly pricing differs from the standard nightly price.  If not  specified here, the property is available at the standard nightly price.

•	property_id - an integer
•	date - a date in the format YYYY-MM-DD
•	availability - 0 if the property is unavailable, 1 if the property is available
•	price - price for the night; an integer in dollars (no cents)

"Searches" - a search to be performed

•	search_id - an integer
•	lat - a float
•	lng - a float<br>
•	checkin - a date in the format YYYY-MM-DD
•	checkout - a date in the format YYYY-MM-DD

Sample Input:

Properties
1,0.29322858181353,-69.8325156543615,500
2,15.8229075627722,102.378248903003,280
Dates
1,2012-08-15,0,500
1,2012-08-26,1,700
Searches
1,0.9802496106877,-70.146252228624,2012-08-14,2012-08-21
2,0.9802496106877,-70.146252228624,2012-08-26,2012-08-28

Output:

Your program should output the properties that match each search, up to a maximum of 10 properties per search.  Some searches may return no results.

The results should be ordered by cheapest total price for the stay, also matching the availability dates and geographic filter.  (If two properties have the same total price, sort by property_id ascending).  For the geographic filter, use a bounding box that is 2 degrees square in total (ie, +/- 1.0 degrees from each coordinate).  If a property is unavailable for any date during the range, it is not a valid result.  If a property has a variable price in the specified date range, that variable price overrides the base nightly price for that night.  The total price is the sum of the nightly prices for the entire stay.

Note that properties do not need to be available on the checkout date itself, just on the day before.

Your program should produce output with the following columns.  Each result for a given search should appear on it's own line.  A search with zero results does not need to be included in the output.

search_id - integer
rank - integer (starting with 1, max of 10)
property_id - integer
total_price - the total price for the stay in dollars

Sample Output:
2,1,1,1200

You shouldn't use any kind of external database or search engine.  Your program should load the input data into memory and then use your own logic and data structures to perform the searches and generate the output.  Using libraries (such as to parse CSV files) is ok.

airbnb-property-search's People

Contributors

zzaman avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.