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.
I do not think there is an issue here ? the Ruby reference solution returns
1
forargs_count("abc")
.This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
Tests in Ruby translation do not supply an expected value when failed.
Try it with a single for loop. Right now, you're looping through each character in
input
twice, effectively making the function take n^2 steps to resolve, wheren
is the length of input. e.g. If you do this with a string of 10,000 letters, it will take 100,000,000 steps to resolve.As I can see,
doRandomTests
ignorescnt
, but everything is very slow already, so I think it should be OK for now; if anything, it can be updated later.The kata author is active, so waiting now...
updated
Missing all kinds of tests (
n = 2000000
etc) that are in the original and other translations. Although some of them may not be entirely necessary for good coverage, some are, so I'd suggest that they should be just copied.Solutions should receive copies of
m
or the reference solution should be called first, otherwise user's solutions can change the array.The reference solution should at least have a random name so that it can't be called from solutions or it could be a locally bound lambda.
Hello! Can someone approve my Ruby translation or give advice on what needs changing? I think my tests might be a bit too lenient, but I'm not certain.
Alright, thanks much clearer!
Read what dulot wrote up there.
The second case doesn't comply to:
Maybe this helps (written by dulot):
Please explain [NORTH SOUTH SOUTH EAST WEST NORTH] => [] but [NORTH WEST SOUTH EAST] => [NORTH WEST SOUTH EAST]
They're not, please, read the instructions again, specially, the Note at the end. That exact case is explained there.
Ruby tests are broken
Case:
Expected: ["NORTH", "WEST", "SOUTH", "EAST"], instead got: []
Since N > W > S > E essentially take you in a circle if you travel the same distance each way, you'd end up at the exact same location.
Loading more items...