{"id":17215566,"url":"https://github.com/paambaati/bumplan","last_synced_at":"2026-01-19T05:33:13.700Z","repository":{"id":42908098,"uuid":"250578106","full_name":"paambaati/bumplan","owner":"paambaati","description":"A simple program that finds the seating arrangement for passengers for a given custom airplane seat layout.","archived":false,"fork":false,"pushed_at":"2023-01-05T17:24:33.000Z","size":276,"stargazers_count":1,"open_issues_count":5,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-12T12:56:05.767Z","etag":null,"topics":["algorithm","coding-challenge","data-structures","interview-questions","nodejs"],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"wtfpl","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/paambaati.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-03-27T15:57:48.000Z","updated_at":"2022-02-03T18:57:01.000Z","dependencies_parsed_at":"2023-02-04T08:31:43.280Z","dependency_job_id":null,"html_url":"https://github.com/paambaati/bumplan","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paambaati%2Fbumplan","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paambaati%2Fbumplan/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paambaati%2Fbumplan/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paambaati%2Fbumplan/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/paambaati","download_url":"https://codeload.github.com/paambaati/bumplan/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247447116,"owners_count":20940259,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["algorithm","coding-challenge","data-structures","interview-questions","nodejs"],"created_at":"2024-10-15T03:24:49.656Z","updated_at":"2026-01-19T05:33:13.694Z","avatar_url":"https://github.com/paambaati.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# bumplan\n\n[![WTFPL License](https://img.shields.io/badge/License-WTFPL-blue.svg)](LICENSE)\n\nA simple program that finds the seating arrangement for passengers for a given custom airplane seat layout.\n\n![Screenshot](SCREENSHOT.png)\n\n\u003csmall\u003e 📣 Note that this project was purpose-built for a coding challenge (see [problem statement](PROBLEM-STATEMENT.md)).\u003c/small\u003e\n\n### 🛠️ Setup\n\nBefore you run this app, make sure you have [Node.js](https://nodejs.org/en/) installed. [`yarn`](https://yarnpkg.com/lang/en/docs/install) is recommended, but can be used interchangeably with `npm`.\n\n```bash\ngit clone https://github.com/paambaati/bumplan\ncd bumplan\nyarn install \u0026\u0026 yarn build\n```\n\n#### 👩🏻‍💻 Usage\n```bash\nyarn start \"\u003cseat_layout\u003e\" \"\u003cpassengers_count\u003e\"\n```\n\n#### 🧪 Tests \u0026 Coverage\n```bash\nyarn run coverage\n```\n\n## 🧩 Design\n\n1. The program first builds a \"mapping\" for the given layout (see [`buildSeatMapping()`](https://github.com/paambaati/bumplan/blob/d03e5c703f7176701140f1565d43a1fa699ac98c/index.ts#L29-L71)). Essentially, the input 2D array is flattened and a lookup table is built, along with the seat types.\n\n    For example, for the layout —\n\n    ```json\n    [[1, 2], [3, 2]]\n    ```\n\n    The mapping built is —\n\n    ```json\n    {\n        '0_0_0': 'W',\n        '1_0_0': 'A',\n        '1_1_0': 'M',\n        '1_2_0': 'W',\n        '0_0_1': 'W',\n        '1_0_1': 'A',\n        '1_1_1': 'M',\n        '1_2_1': 'W'\n    }\n    ```\n\n2. The mapping is then used to filter by seat types first and then iterated over to assign passenger number (see [`assignSeats()`](https://github.com/paambaati/bumplan/blob/d03e5c703f7176701140f1565d43a1fa699ac98c/index.ts#L77-L90)). As a nice bonus, the method will also optionally take a priority list, so it will be easier to alter the seating rules in the future.\n\n3. The seat assignment is then printed on the screen (see [`printSeatAssignments()`](https://github.com/paambaati/bumplan/blob/d03e5c703f7176701140f1565d43a1fa699ac98c/index.ts#L92-L125)). It uses the super-lightweight [`colorette`](https://www.npmjs.com/package/colorette) to print in colors to quickly distinguish the seat types.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpaambaati%2Fbumplan","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpaambaati%2Fbumplan","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpaambaati%2Fbumplan/lists"}