Beta
Print chains
Loading description...
Algorithms
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.
Given initial array
The first entry of the reference solution is
{"wr":["wrriirryyVVyyHHyyNN6","wrriirryyVVyyHHyyNNvvEEOORRaab"]}
. This doesn't satisfy the rule that chains in each of resulting array's element's value should respect initial array's elements order. You can't continue the chain afterwrri
becauseri
is the last element.Also, I would expect the solution to start with
{"KJ":["KJJc",...]}
. But that's another issue.Please fix the solution or describe the problem better.
Random tests break if input is modified from user code.
Reference solution is obviously wrong: it rejects any keys that contain the pattern
AbbA
if bothAb
andbA
are in the input list.I suspect your reference solution has a horrible bug. Note that you have no solutions.
What would be the expected outcome for
(["ab","ba"])
? If it's not{ ab:[abba], ba:[baab""] }
, you should update the description. If it is, take a good look at your reference solution.Generating ridiculously long input arrays for the random tests isn't helping - it's almost imposible to debug because you're drowning in data. I'm not getting time-outs - I'm getting console overflows from printing all the actual and expected values. ( Also, use
Test.assertDeepEquals
. Yes, it's undocumented. )Sort of an issue:
All the chains in the fixed tests have elements in sequential order in which they appear in the
data
array, but random tests apparently assumes the opposite. (And it's not clear in the descriptions that it's the case either.)They have data sorted by length ascending, then in
data
order. It's an artifact of the reference algorithm.PS1: Chains in each of resulting array's element's value should respect initial array's elements order.
In what order? First by length and then...?
There's something wrong with the tests. I didn't code anything and it just passes.
Sorry, my bad. Fixed that.