Skip to content

Instantly share code, notes, and snippets.

@kalouo
Last active April 2, 2021 02:48
Show Gist options
  • Save kalouo/f90c2595151ee8d9517b88c4316201d1 to your computer and use it in GitHub Desktop.
Save kalouo/f90c2595151ee8d9517b88c4316201d1 to your computer and use it in GitHub Desktop.
Zipmex Backend Challenge

Zipmex Backend Challenge

Welcome to the Zipmex backend challenge! Thanks for attempting it, we wish you good luck!

We prefer well-thought out, quality code over quick-and-dirty solutions. So - please take your time, if you need it.

Instructions

  • Create an server application in your language/framework of choice.
  • Write an algorithm that will take a JSON object structured like Appendix 1 Input and transform it into the structure shown under Appendix 2 Output. In other words, the algorithm will place "children" objects under the correct "parent" objects.
  • Add a single endpoint that takes the unstructured JSON object as parameter and responds with the structured JSON object.

Guidelines

  • Please use Elixir, Scala or NodeJS.
  • Do not forget to write comprehensive tests.
  • Do not forget to write documentation.
  • Have some fun!

Submission

  • Please submit via a git format-patch. Send your patch to the hiring team.
  • Please keep track of the number of hours spent on this challenge and send along with your submission.

Deliverables

  • As a reviewer, I can run your tests with a simple command.
  • As a reviewer, I can boot your application locally and call the endpoint.
  • As a reviewer, I can find clear documentation on how to check for the above two deliverables.

Appendix 1 Input

{"0":
  [{"id": 10,
    "title": "House",
    "level": 0,
    "children": [],
    "parent_id": null}],
 "1":
  [{"id": 12,
    "title": "Red Roof",
    "level": 1,
    "children": [],
    "parent_id": 10},
   {"id": 18,
    "title": "Blue Roof",
    "level": 1,
    "children": [],
    "parent_id": 10},
   {"id": 13,
    "title": "Wall",
    "level": 1,
    "children": [],
    "parent_id": 10}],
 "2":
  [{"id": 17,
    "title": "Blue Window",
    "level": 2,
    "children": [],
    "parent_id": 12},
   {"id": 16,
    "title": "Door",
    "level": 2,
    "children": [],
    "parent_id": 13},
   {"id": 15,
    "title": "Red Window",
    "level": 2,
    "children": [],
    "parent_id": 12}]}

Appendix 2 Output

[{"id": 10,
  "title": "House",
  "level": 0,
  "children":
   [{"id": 12,
     "title": "Red Roof",
     "level": 1,
     "children":
      [{"id": 17,
        "title": "Blue Window",
        "level": 2,
        "children": [],
        "parent_id": 12},
       {"id": 15,
        "title": "Red Window",
        "level": 2,
        "children": [],
        "parent_id": 12}],
     "parent_id": 10},
    {"id": 18,
     "title": "Blue Roof",
     "level": 1,
     "children": [],
     "parent_id": 10},
    {"id": 13,
     "title": "Wall",
     "level": 1,
     "children":
      [{"id": 16,
        "title": "Door",
        "level": 2,
        "children": [],
        "parent_id": 13}],
     "parent_id": 10}],
  "parent_id": null}]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment