Athira (ex-Motorola), Souranil (ex-ThoughtWorks) and 200+ developers have solved Geektrust coding challenges to find great jobs
over the last 4 years
✴ Get priority and be treated as a premium candidate to directly connect with decision makers at companies.
✴ Get membership and win an exclusive Geektrust DEVELOPER t-shirt.
Over 3000 developers from the best companies in the world have trusted us with their code. And we don’t look just at the output, but how you get it is
more important. We care about how well modelled your code is, how readable, extensible, well tested it is. Check out our coding help page to ensure
you get a good score.
© 2020 geektrust. All rights reserved.
Getting started
1. Getting the output right is important, but more important is clean code and how well designed your code is.
You should absolutely see our Help page post on what we look for in your code, and how to get started
with the coding challenge.
2. See our evaluation parameters here and the badges to earn here.
3. We expect a command line app. So no web apps will be considered for evaluation. You don’t need data
stores either.
© 2020 geektrust. All rights reserved.
Problem Context
Our story is set in the planet of Lengaburu......in the distant, distant
galaxy of Tara B. And our protagonists are King Shan, Queen Anga &
their family.
King Shan is the emperor of Lengaburu and has been ruling the
planet for the last 350 years (they have long lives in Lengaburu, you
see!). Let’s write some code to get to know the family.
This coding problem is for backend and fullstack developers.
© 2020 geektrust. All rights reserved.
Family Tree
© 2020 geektrust. All rights reserved.
Meet The Family
Write code to model out the King Shan family tree so that:
• Given a ‘name’ and a ‘relationship’, you should output the people corresponding to the relationship in the order in
which they were added to the family tree. Assume the names of the family members are unique.
• You should be able to add a child to any family in the tree through the mother.
Simple, right? But remember.. our evaluation is based not only on getting the right output, but on how you've written your code.
Relationships To Handle
There are many relations that could exist but at a minimum, your code needs to handle these relationships.
Relationships Paternal-Uncle Maternal-Uncle Paternal-Aunt Maternal-Aunt Sister-In-Law Brother-In-Law Son Daughter Siblings
Spouse’s
Spouse’s sisters, brothers,
Definition Father’s brothers Mother’s brothers Father’s sisters Mother’s sisters
Wives of siblings Husbands of
siblings
© 2020 geektrust. All rights reserved.
Sample Input/Output
Do initialise the existing family tree on program start. Your program should take the location to the
test file as parameter. Input needs to be read from a text file, and output should be printed to the
console. The test file will contain only commands to modify or verify the family tree.
Input format to add a child: Example test file:
ADD_CHILD ”Mother’s-Name" "Child's-Name" ADD_CHILD Chitra Aria Female
"Gender" GET_RELATIONSHIP Lavnya Maternal-Aunt
GET_RELATIONSHIP Aria Siblings
Input format to find the people belonging to a relationship:
GET_RELATIONSHIP ”Name” “Relationship”
Output on finding the relationship:
Output format on finding the relationship:
CHILD_ADDITION_SUCCEEDED
Aria
”Name 1” “Name 2”… “Name N”
Jnki Ahit
© 2020 geektrust. All rights reserved.
More sample input output scenarios.
Please stick to the Sample input output format as shown. This is very important as we are automating the
correctness of the solution to give you a faster evaluation. You can find some sample input output files here.
Sample 1 Output on finding the relationship:
ADD_CHILD Pjali Srutak Male PERSON_NOT_FOUND
GET_RELATIONSHIP Pjali Son PERSON_NOT_FOUND
Pjali does not exist in the family tree
Sample 2 Output on finding the relationship:
ADD_CHILD Asva Vani Female CHILD_ADDITION_FAILED
GET_RELATIONSHIP Vasa Siblings NONE
Asva is male, hence child addition failed
Sample 3 Output on finding the relationship:
GET_RELATIONSHIP Atya Sister-In-Law Satvy Krpi
© 2020 geektrust. All rights reserved.
Python - Instructions to Build & Execute
Solution with build file
We support only Pip build system. You can add your dependent packages and versions in requirements.txt.
The Main file should be named as geektrust.py. This is the file that will contain your main method.
We then execute the solution by the following command. Read more.
pip install -r requirements.txt
python -m geektrust <absolute_path_to_input_file>
Solution without build file
For a solution without build system, we want you to name your Main file as geektrust.py. This is the file that will contain your
main method. We then execute the solution by the following command. Read more.
python -m geektrust <absolute_path_to_input_file>
© 2020 geektrust. All rights reserved.
Supported Language & Versions
Code submissions are run against a Linux virtualized instance.
Supported language and versions are below:
Language Supported versions Supported Tools
C# dotnet core 2.2, 3.1 dotnet
Go 1.12.x Go build tool
Java 1.8, 1.11 maven, gradle
Node.js 8.16.x, 10.16.x, 12.6.x npm, yarn
Python 3.7, 3.8 pip
Ruby 1.9.x, 2.2.x, 2.6.x rake, bundler-rake
You can upload code in any version of Clojure, C++, Erlang, Groovy, Kotlin, PHP, Scala. We don't have
automated tests for these languages yet. So your evaluation will take longer than the others.
© 2020 geektrust. All rights reserved.
Check list - submitting code
1. Please compress the file before upload. We accept .zip, .rar, .gz and .gzip
2. Name of the file should be the problem set name you are solving. For e.g. if you have solved Family
problem, please name your file ‘Family.zip’.
3. Please upload only source files and do not include any libraries or executables or node_modules
folder.
4. Usage of non-essential 3rd party libraries will affect your evaluation.
5. Add a readme with how to get your code working, and how to test your code.
6. Your solution will be downloaded & seen by companies you’re interested in. Hence we advise you to
provide a solution that will work on any system without any code changes/manual setup.
© 2020 geektrust. All rights reserved.
what next?
© 2020 geektrust. All rights reserved.