{"id":28720093,"url":"https://github.com/albumprinter/algorithm-engineer-assignment","last_synced_at":"2026-01-30T21:37:14.464Z","repository":{"id":82303462,"uuid":"353651498","full_name":"albumprinter/algorithm-engineer-assignment","owner":"albumprinter","description":null,"archived":false,"fork":false,"pushed_at":"2024-02-07T15:39:58.000Z","size":65,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":55,"default_branch":"master","last_synced_at":"2025-06-15T06:06:52.111Z","etag":null,"topics":["area-ecommerce","build-babushka","code-scanning-not-supported","deploy-octopus","domain-checkout","hosting-aws","owner-chaos-monkeys","type-application"],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/albumprinter.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2021-04-01T09:50:17.000Z","updated_at":"2024-02-08T11:51:20.000Z","dependencies_parsed_at":null,"dependency_job_id":"63fdcd81-d758-4bb2-98e6-0c7cb18ad89e","html_url":"https://github.com/albumprinter/algorithm-engineer-assignment","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/albumprinter/algorithm-engineer-assignment","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/albumprinter%2Falgorithm-engineer-assignment","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/albumprinter%2Falgorithm-engineer-assignment/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/albumprinter%2Falgorithm-engineer-assignment/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/albumprinter%2Falgorithm-engineer-assignment/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/albumprinter","download_url":"https://codeload.github.com/albumprinter/algorithm-engineer-assignment/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/albumprinter%2Falgorithm-engineer-assignment/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28919732,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-30T20:25:28.696Z","status":"ssl_error","status_checked_at":"2026-01-30T20:25:13.426Z","response_time":66,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["area-ecommerce","build-babushka","code-scanning-not-supported","deploy-octopus","domain-checkout","hosting-aws","owner-chaos-monkeys","type-application"],"created_at":"2025-06-15T06:06:54.986Z","updated_at":"2026-01-30T21:37:14.446Z","avatar_url":"https://github.com/albumprinter.png","language":null,"readme":"\u003cimg src=\"default_albelli.nl.jpg\" width=\"200\"\u003e\n\n# Algorithm Engineer Technical Assignment\n\n## Things we look for in this test\n\nWe expect the candidate to show us they can solve algorithmic problems in a\nclear and concise manner. Test cases should be included to demonstrate\ncorrectness. We value _simple_ more highly than _complex_, _working_ is better\nthan _nice_. Readability matters.\n\n## Problem\n\nA customer would like to place their photos in a photobook. Flipping through the\nbook, certain photos are expected to be placed on a page before others. For\nexample:\n\n- a picture of a wedding should come on a page before one of the honeymoon\n- photos of a child unwrapping their birthday gift should be on earlier pages\n  than pictures of them playing with their new toy\n\nOur state-of-the-art algorithms can predict which pairs of photos in a set have\nthis property. We want to automatically place all the photos in a book using as\nfew pages as possible.\n\n## Assignment\n\nThe first line of the input consists of three numbers `n`, `m` and `k`, where\n`n` is the total number of photos in the set (labeled `1,2,..,n`) and `m` the\nmaximum allowed number of photos per page.\n\nThen follow `k` lines, with on every i\u003csup\u003eth\u003c/sup\u003e line two numbers `u_i` and\n`v_i`. This defines the property that photo `u_i` should be on a page that comes\nstrictly before the page containing photo `v_i`.\n\nOutput should consist of a single line, containing either a single number\nindicating the minimum number of pages required to place all photos, or\n`Impossible` if no valid book can be created.\n\n## Example 1\n\n```\n          ┌───┐\n          │ 2 │\n          └───┘\n            │\n            │\n            ▼\n┌───┐     ┌───┐\n│ 3 │ ──▶ | 1 │\n└───┘     └───┘\n            │\n            │\n            ▼\n          ┌───┐\n          │ 4 │\n          └───┘\n```\n\nInput file\n\n```\n4 2 3\n2 1\n3 1\n1 4\n```\n\nExpected output: `3`\n\nPictures `2` and `3` can go on the first page, `1` on the second, and `4` on the\nthird.\n\n## Example 2\n\n```\n          ┌───┐\n          │ 2 │\n          └───┘\n            │\n            │\n            ▼\n┌───┐     ┌───┐     ┌───┐\n│ 4 │ ──▶ │ 1 │ ◀── │ 3 │\n└───┘     └───┘     └───┘\n            │\n            │\n            ▼\n          ┌───┐\n          │ 5 │\n          └───┘\n```\n\nInput file\n\n```\n5 2 4\n2 1\n3 1\n4 1\n1 5\n```\n\nExpected output: `4`\n\nPictures `2` and `4` can go on the first page, `3` on the second, `1` on the\nthird, and `5` on the fourth.\n\n## Example 3\n\ninput file\n\n```\n11 2 0\n```\n\nExpected output: `6`\n\n## Constraints\n\n    1 \u003c= n \u003c= 15\n    1 \u003c= m \u003c= n\n    0 \u003c= k \u003c= n * (n - 1) / 2\n    1 \u003c= u_i, v_i \u003c= n for all i\n\n## Source Code\n\nYou should create a public GitHub and let us know when you've completed the\nexercise. Only C/C++, Java(Kotlin, Scala), Rust and C#(F#) are allowed.\n\n## Tools and libraries\n\nYou are free to use any additional third-party libraries and/or frameworks.\n\n## Additional information\n\nDocument a method of compiling your code and running a test case(s).\n\nYour application should be able to take input from the test file, and print only the result number to stdout.\n\n```shell\n$ myprogram  input1.txt\n3\n```\n\n## Bonus requirements\nAfter you finish your assignment, you can convert it to Python and add to the same repo. This is not a hard requirement, but might add some bonus points.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falbumprinter%2Falgorithm-engineer-assignment","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falbumprinter%2Falgorithm-engineer-assignment","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falbumprinter%2Falgorithm-engineer-assignment/lists"}