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.
Found in what??
Indeed. Thanks!
Fixed.
The error messages were wrong. Fixed.
Certainly not a "Best Practice"
I don't understand this test case.
For str = '01124352345112302345234523045' and K = 13
Expected 3.Your fn returned 11
Which 3 are expected? There are four 1s and five 4s in the string
Edit:
Tried to return '3' for the above case and I get this one now:
Expected 3.Your fn returned 3
This comment is hidden because it contains spoiler information about the solution
What is wrong with "01" as a square?
Returning
Infinity
above thek
cutoff itself already is pointless. It has nothing to do with finding squares in strings."Do one thing, and do it well."
The return type as strings are... kinda pointless. Why not just numbers? JS's number type has both numbers and
Infinity
.Please don't use
Test.expect
whenTest.assertEquals
will perform the tests just as well and has infinitely better feedback.Needs random tests
Index of (5,5) = (1,5) : Highest index = 5
Index of (3,7) = (3,4) : Highest index = 4
The pair with the lower value of highest index seems to be the answer