6 kyu

Seventh JSON of a seventh JSON

117 of 188kingcobra

Description:

Context

According to Wikipedia : "The seventh son of a seventh son is a concept from folklore regarding special powers given to, or held by, such a son. The seventh son must come from an unbroken line with no female siblings born between, and be, in turn, born to such a seventh son."

Your task

You will be given a string of JSON, consisting of a family tree containing people's names, genders and children. Your task will be to find the seventh sons of seventh sons in the family tree, and return a set of their names. If there are none, return an empty set.

Tips

  • Have a good look at the sample test cases.

  • For a seventh son to be a seventh son, there must not be any daughters in the line leading to him. There may be daughters after him, though.

  • Use print_tree preloaded function to print the family tree in a compact human-readable form

  • You may want to use the json module for this one.

JSON
Recursion
Fundamentals

Similar Kata:

Stats:

CreatedNov 22, 2017
PublishedNov 22, 2017
Warriors Trained1188
Total Skips23
Total Code Submissions4347
Total Times Completed188
Python Completions117
JavaScript Completions81
CoffeeScript Completions6
Total Stars43
% of votes with a positive feedback rating88% of 56
Total "Very Satisfied" Votes45
Total "Somewhat Satisfied" Votes8
Total "Not Satisfied" Votes3
Total Rank Assessments4
Average Assessed Rank
6 kyu
Highest Assessed Rank
6 kyu
Lowest Assessed Rank
6 kyu
Ad
Contributors
  • kingcobra Avatar
  • siebenschlaefer Avatar
  • Voile Avatar
  • Kacarott Avatar
  • avermakov Avatar
Ad