Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
Memoization via a stream isn't good enough to solve this kata. You'll have to study the link provided in the description.
This comment is hidden because it contains spoiler information about the solution
I tried it and it failed in two of the test cases (I think where one array was empty and the other was null)
This comment is hidden because it contains spoiler information about the solution
group() without parameter corresponds to all the characters matching the regex pattern. Group(1) corresponds to the group 1 in the regex pattern.
With the string
abc-def
and the regex pattern.-(.)
group() returnsc-d
and group(1) returnsd
My solution now fails the
Woof-shhh-woofwoof!
test case as it should.What are the odds of this happening? Unfortunately they seem to be too low so I can't consider the issue resolved. My wrong solution still passes 50000 random tests consistently.
That can't be true. I, for example, have this test
To make sure, I added this in my test cases
Random tests can generate woofless subsequences too
Is it now resolved?
Considering each subsquence one woof (even if it doesn't contain a woof) wouldn't get you through the tests. If I understood you wrong, please clarify
I changed the beginning of the third item in the "things to keep in mind" list to
Also, I highlighted the word "letters" in bold while making some minor edits to make the meaning clearer
You can re-raise (hopefully, providing additional clarifications) in case you deem it insufficient
Do you think it's unclear? How do you think I can improve it?
also
The expected output of your example string is
nothing to decode!
since neither of the subsequences (which are: 'w', 'o', 'o', and 'f') contains a woofFixed
This comment is hidden because it contains spoiler information about the solution
I think there's a confusion in the thread. The author's solution generates a geometric distribution, which is not wrong per se but generates a distribution that gives short length most of the time and rarely (but can) generate long lengths. See graphs at: https://en.m.wikipedia.org/wiki/Geometric_distribution
The fact that NunoOliveira and Hobovsky are talking about 'the range' is an indication that there's just a misunderstanding.
Hobovsky, your kumite showcases a common mistake when writing tests generating a uniform distribution, but that's not what happening here. Note that the condition here does not depend on the loop counter.
I don't think it's a problem per se that the tests generates a geometric distribution. It's a common mistake to use
Math.random()
in the loop condition but it's not what happening here.I'm closing this issue as the author's code is most likely working as intended.
Again, why does that happen under such circumstances?
Because it wasn't fixed. The issue still remains.
Loading more items...