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.
Sounds good. If I get some time in the next few days I'll try to replicate and dig deeper.
@aewhite, change
MAX_S_LENGTH
in your solution to7
, and it will fail the following test:In this case, your solution returns
0
while it should return1
.Changing
MAX_S_LENGTH
back to100_000
will solve this problem, but your solution will still fail some really big random test like Voile mentioned above.You'd be surprised how often everyone expects matches to be non-overlapping. As a prime example, Apache Commons
StringUtils.countMatches
specifically says the match is non-overlapping, and people keep referring to that when asked "how to count number of occurrences of a substring in a string in Java".To get this for small results you need to reduce
MAX_S_LENGTH
andn
, to something like1500
and10 - 20
.It probably means your
MAX_S_LENGTH
is still not big enough.Well, but it's big, like this:
I'm not sure I understand. I just tested the reference solution locally and got 376 on the inputs your provided. Do you have a particular test I could try to debug?
This was intentional. The description and tests where meant to be illustrative but not exhuastive. I can certainly add an overlapping hint but I feel that the language of "counts occurrences of a given string" is precise enough.
Both description and sample tests fail to emphasize that the occurrence count is overlapping. It only occurs in the actual tests.
Reference solution for the random tests is something wrong. I managed to capture this after modifying the random tests a bit:
This test case is small enough that this can be validated by constructing the string manually, and the result is indeed 376.
anyone trying this approach please read the question again it's mentioned we need to create a database so that we can directly use it. So store all the language in something
Isn't that just a function of how many 1 kyu Java kata there are? You get what, 128 points for a 1 and 2 kyu? The site isn't going to check what percentage of 1kyu kata you've completed.. if you want to get to 1kyu in JS, do 2s, 3s and 4s.
I'm having some issues solving this in Java. I'm at 101 passing and 14 failing. I've run across some test cases which seem to me to be intended to test something (by test case name), but my understanding of whitespace leads me to believe the tests should be expecting exceptions to be raised. However, the test is reporting the exceptions are unexpected.
My understanding of how to parse code:
In my implementation I am first reading through commands to set target locations for marked labels. This code has none (again, if I am reading it correctly).
So in execution, I pass command 1 fine, but when I get to command 2 (nstsn), it is askign to jump to a subroutine labeled "s". There is none, so I'd think I should throw an exception for an invalid label. However, the test is reporting that this exception is unexpected (and, by the name of the test it'd appear intended to actually jump to a subroutine).
I'm confused, because I know a bunch of folks have solved this (currently 33 in Java), so I wouldn't think it an error in the test, but I am the end of my rope in getting past my misunderstanding.
I'm seeing the same issue with:
The test cases for Java appear to be hosed.
So... it expected an exception and it got an exception and the test failed?
Plus everything DSchwettmann said is correct.
As a matter of observation, I am new to the site and decided to jump right in and do all 1k katas for Java and even after completing all of them, my ranking in Java is just 3k. It seems odd that I can solve literally every problem in class and still be ranked two levels below the given class.