Giter Club home page Giter Club logo

puzzle's Introduction

Code Puzzle

The Evaluation

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

Best Available Seat

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

Technology

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.

Extra Credit

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

puzzle's People

Contributors

schof avatar

Watchers

 avatar  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.