/airplane-seating-algorithm

A simple Node.js program that gives the seating arrangement of passengers for airplane seat layout with custom conditions.

Primary LanguageJavaScriptMIT LicenseMIT

Airplane Seating Algorithm

Table of Contents

Built With :

Getting Started

This is a list of needed instructions to set up your project locally, to get a local copy up and running follow these instructions.

  1. Clone the repository.

  2. Follow this article to install node js and npm Install Node js and npm.

  3. npm i && npm start "[[3,2],[4,3],[2,3],[3,4]]" "30"

Description

A simple Node.js program that gives the seating arrangement of passengers for airplane seat layout with custom conditions.

This program was built for a coding challenge, you can see the requirements file in documentation/requirements.pdf

Rules for seating:

  • Always seat passengers starting from the front row to back, starting from the left to the right.
  • Fill aisle seats first followed by window seats followed by center seats (any order in center seats)

Screenshots

  1. Example from requirements.

  2. Expected output.

  3. Output example (1), note that 0 means an empty seat.

  4. Output example (2).