Coding Games and Programming Challenges to Code Better
Send your feedback or ask for help here!
Created by @GamingGnawer,validated by @Remi,@Boris-Bodin and @Daniel_Kirchner.
If you have any issues, feel free to ping them.
Coding Games and Programming Challenges to Code Better
Send your feedback or ask for help here!
Created by @GamingGnawer,validated by @Remi,@Boris-Bodin and @Daniel_Kirchner.
If you have any issues, feel free to ping them.
I don’t get it. How do I determine which one the kangaroo word is?
You have to check the words against one another.
Say, if you are checking whether word_k is a kangaroo word for word_j, you may loop through each character of word_j to see if the characters appear in ascending positions in word_k.
Hi all, my code (in Python) passed all tests but failed Validator 2. Do you have any hint, what is the problem?
It’s difficult to tell. But try whether your code passes the following custom case:
Input
1
jeez, beep, pfft, ez
Output
jeez: ez
@5DN1L Thank you very much. It does not pass.
Thank you @5DN1L ! I stumbled upon two issues with the statement which led to confusion, at least for me. Thus, my low level question in my first post.
First: The statement could be more concise what should happen if one thesaurus includes multiple valid kangaroo words. All of them are expected to be part of the output.
For example: thesaurus: ["aaah", "aah", "ah"] yields aaah: aah, ah and aah: ah.
Second: NONE is expected if and only if there are no valid kangaroos at all. If one single thesaurus does not contain a kangaroo word, but others do, the line is expected to be ignored.
Indeed there may be confusion. I’ll pass on your comment to the author for their consideration. Thank you.
Can you share validator 6 or 8? I’m passing all tests but failing the NONE validators.
I am using a regular expression on the excluded chars of each word, its working well on tests but the validators got me blocked for hours now.
It’s not a good idea to share the validators here in public. But if you want, you may send me your code in private message and I’ll try to come up with some custom cases to help you debug.
I know how frustrating it is when your code passes the test cases but not the validators…
Not sure if this helps identify your issue, but you can try this custom code:
1
deed, move, step
result should be:
NONE
Thanks, my error was not getting the synonyms by line, I was joining all words in a single bucket instead of processing each line of words separately.
Below is a custom case which may help players who fail Validator 6:
Input
2
as, since
aseptic, disinfectant
Output
NONE
I produced
aaaah: aaah, aah, ah
aaah: aah, ah
aah: ah
ooh: oh
oooh: ooh, oh
ooooh: oooh, ooh, oh
on test 5, but the answer is
aaaah: aaah, aah, ah
aaah: aah, ah
aah: ah
ooh: oh
oooh: oh, ooh
ooooh: oh, ooh, oooh
For the ahs it has the longer words come first but for the ohs it has the shorter words come first.
What’s with the switcharoo? Is it needed? Or is this being a mean kangaroo?
I realized my mistake. The keys need to be in alphabetical order and so do the values.
1 year later, this rewording issue still had not been fixed yet…
OTOT, the joey word for each kangaroo word must also be sorted in alphabetical order too…
You might be surprised how many puzzle authors are no longer active on CG shortly after their puzzles have been approved…
Anyway, since the author didn’t respond to my comment from a year ago, I’ve gone ahead and reworded the statement myself. Hopefully, it’s clearer now.
Second point has been made clear now. But I still can’t find where was mentioned that a line may contain more than 1 kangaroo word. Perhaps changing the examples to this one might help a lot!
For example:
thesaurus: ["aaah", "aah", "ah"]yieldsaaah: aah, ahandaah: ah.
Also , this statement is confusing at least as some may interpret it as a line can only contain ONLY 1 kangaroo word.
All words are considered synonyms with all words in the same thesaurus group (one input-line) and with no other words.
Perhaps, it should be re-worded to
All words are considered synonyms with all words in the same thesaurus group (one input-line) and with no other words from other lines of thesaurus group.
(a) I’ve changed:
Given a thesaurus, consisting of words grouped by synonyms, you must identify all kangaroo words and their corresponding joey words.
to:
Given a thesaurus, each input line being one group of synonyms, identify all kangaroo words and their corresponding joey words within each group.
(b) I’ve deleted the following. After the above rewording, I don’t think anyone should overthink the problem and try to process multiple input lines as if they’re related.
All words are considered synonyms with all words in the same thesaurus group (one input-line) and with no other words.
(c) I’ve changed this:
The program must first identify all the kangaroo words and all their joey words for every input-line of synonyms,
to this:
The program must first identify all kangaroo words (note: there may be one or more) and all their joey words for each input line of synonyms,
(d) I’ve also taken the chance to change the explanation in the example because the original one just repeats the task without any real explanation. From this:
Output the 2 kangaroo words on separate lines in alphabetical order. After each kangaroo output {{: }} followed by all corresponding joeys, in alphabetical order, separated by {{, }}
to this:
There are two kangaroo words, observe and container. Their joey words are see, and can and tin respectively. After sorting, the output should be:
Why testcase #6 is expected to return NONE
aimless, fruitless, futile, pointless
futile is a joey for fruitless, is it not? Am I missing something?