We will review your submission based on the following criteria (in no particular order):
- The ability to follow instructions
- Quality of code submission
- Adherance to best practices
- Clarity of documentation
Write a REST API to return the best available seat (closest to the front & middle) given a list of open seats. Rows follow alphabetical order with A
being the first row. Columns follow numerical order from left to right (starting with 1
).
The list of open seats, number of rows and columns (seats) should be configurable and based on a JSON input.
{
"venue": {
"layout": {
"rows": 10,
"columns": 50
}
},
"seats": {
"a1": {
"id": "a1",
"row": "a",
"column": 1,
"status": "AVAILABLE"
},
"b5": {
"id": "b5",
"row": "b",
"column": 5,
"status": "AVAILABLE"
},
"h7": {
"id": "h7",
"row": "h",
"column": 7,
"status": "AVAILABLE"
}
}
}
The solution should find the best open seat (closest to the front & middle) given the input JSON and number of requested seats. Imagine a concert, people want to be as close as possible to the stage. To keep things simple, any seat in a closer row will always be preferred to a seat in a further row.
For example, for a venue
with 10 rows
and 12 columns
with all seats open, the best seat would be either A6
or A7
.
If a group of seats is requested, the algorithm needs to find the best open group of seats together. In the example above, for 3 seats
, it would be A5
, A6
, and A7
.
For 5 columns
and 2 requested seats
the best open seats - assuming the first row A
is fully occupied and the second row B
is fully open, would be B2
and B3
.
All results should be returned as JSON.
Additional Requirements:
- The app should have automated tests
- The app needs a
README.md
explaining the app and steps to run it locally - Your submission should be in a private Github repo
Use whatever set of technologies that you are comfortable with. This is meant to be a demonstration of your problem solving ability - it's not a test of how well you know a particular programming language.
If you are interested, try improving the solution by adding one or more of the following:
- Expand the algorithm so that a user can request multiple seats (together)
- Web app that shows a seat view and shows the best available seats based on the requested number of seats