6 kyu
Seventh JSON of a seventh JSON
117 of 190kingcobra
Loading description...
JSON
Recursion
Fundamentals
View
This comment has been reported as {{ abuseKindText }}.
Show
This comment has been hidden. You can view it now .
This comment can not be viewed.
- |
- Reply
- Edit
- View Solution
- Expand 1 Reply Expand {{ comments?.length }} replies
- Collapse
- Spoiler
- Remove
- Remove comment & replies
- Report
{{ fetchSolutionsError }}
-
-
Your rendered github-flavored markdown will appear here.
-
Label this discussion...
-
No Label
Keep the comment unlabeled if none of the below applies.
-
Issue
Use the issue label when reporting problems with the kata.
Be sure to explain the problem clearly and include the steps to reproduce. -
Suggestion
Use the suggestion label if you have feedback on how this kata can be improved.
-
Question
Use the question label if you have questions and/or need help solving the kata.
Don't forget to mention the language you're using, and mark as having spoiler if you include your solution.
-
No Label
- Cancel
Commenting is not allowed on this discussion
You cannot view this solution
There is no solution to show
Please sign in or sign up to leave a comment.
I don't think it's ok that some test cases exceed 1MB (while still allowing plenty of incorrect solutions) .. and it's kind of silly that thousands of people use only a couple handfulls of names as well.
Question: Is
O
a ssoss?Issue1: this is not tested (python), specifically that a daughter comes before the seven sons
Issue2: description is vague on what the result should be
It's been so hard for 6kyu =)
Great kata to learn dynamic programming, especially to exercise recursion with.
python version has code in preloaded for no reason
Fixed
(python)
These two solutions, both of which pass:
https://www.codewars.com/kata/reviews/5a15fed357f0af5e19001946/groups/6146095c0d73b6000140e7d0 https://www.codewars.com/kata/reviews/5a15fed357f0af5e19001946/groups/6145f501427c9d0001d75559
produce different answers for this pretty basic input:
The point of contention is how to deal with females in the lineage. In particular, the question is whether the presence of a female...
The random tests do not appropriately cover this (as can be seen in my solution, which terminates the search in a given branch if a female is found within the first 7 children of any given ancestor)
Fixed
there is still this rather confusing "tip":
which I don't think my solution adheres to, I'm on a phone though so I struggle to figure out what's what
and uh, https://www.codewars.com/kata/reviews/5a15fed357f0af5e19001946/groups/683984554f242c9c07583249 looks to me like it allows 9th child starting with 2 female to count as 7th but I guess that gets to pass? haven't tested it though. and that might be correct but it's not what mine does and that should be tested.
It would be extremely useful to have sample tests which cover more than just base cases, because debugging random tests is a pain in the ass.
(a pin... ;p )
I keep failing the test cases where, after adding two sons to the set, the lastly added son has no more children. It seems I am missing 12 more sons in the result. Where am I wrong in understanding the task?
This comment has been hidden.
This comment has been hidden.
Look at the test cases:
Test.assertDeepEquals(findSeventhSonsOfSeventhSons(JSON.stringify(containsSeventhSonOfSeventhSon)), new Set('O'));
findSeventhSonsOfSeventhSons
receives astring
.Hi,
In pyhton: I'm passing the fixed tests, but failing at the random tests. The big problem is that I currently cannot print anything to the console (I bet the input is too long?) in order to debug my code and understand what I missed.
Network Error This error was caused due to an issue processing the web request, not because of an issue executing your code. You can retry the request.
{'Lord Crewe'} should equal {'Ronald', 'Borin', 'Destrian', 'Carac', 'Tristan', 'Merek', 'Doran', 'Sir John Fenwick of Wallington', 'Janshai', 'Fendrel', 'Lord Cornwallis', 'Rulf', 'Lord Crewe'}
I bet that it's a problem of depth of the tree... So you should add at least one fixed test of depth 3 or 4, s that it will be possible to debug more easily.
EDIT: It was interesting either way. :) But you really have to has some fixed tests. Spoiler below with what my code was lacking.
This comment has been hidden.
really need more tests ;)
I just passed with python. I also realize this difference when using print.
However I don't think it's an issue. In fact just using print doesn't cause an error. The problem (i think) is that the data to be printed may be too long..
Yes, that's what I said. And the issue is that the kata is lacking some fixed tests, so. ;)
I'm not sure I follow everything you said. I do agree that there should be more fixed tests. However, I don't have time to look into it now, and I can't unpublish the kata for some reason (the button just doesn't appear).
it's because it's already approved. Don't worry about the time. Just do it when you'll have it. Tell me if you want that I reword some parts.
Thank you. I'll be back!
Fixed (8 years later :D)
Approved
JavaScript and Coffeescript translations kumited. Have fun!
Thank you! :)
From the description it's unclear if the seventh son may have sisters who are older than all of the brothers (
['female', 'male', 'male', 'male', 'male', 'male', 'male', 'male (seventh son?)']
). You could also add a test where a seventh son has a younger sister (['male', 'male', 'male', 'male', 'male', 'male', 'male (seventh son)', 'female']
).Thank you. I'll add some precisions to the description.
Is the description clearer now?
Yes, it is. Thank you!