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.
No, it doesn't fail. It correctly returns false.
The kata description has "No whitespaces / underscore" as one of the necessary conditions for a true return value.
Edit: Oh! I see what you mean. You're right, it incorrectly returns true.
That's not quite true. If the multiline flag is not set,
$
matches the end of the string or the position before a trailing newline.Fails on inputs that are otherwise valid with a trailing newline such as
'helloworld\n'
hardly elegant to use isalnum, more hamfisted and lazy in context of the kata
When I started solving this kata (Rust), I thought it was too easy to merit a 2 kyu rating.
Then I started fighting with the poorly written test suite. Christ. Now I see why it's 2 kyu.
It's not enough to meet the explicit requirements. You also have to anticipate how the author thinks about math.
The tests are so finicky. For example, you fail if you express
as
instead of the less simple
And God help you if you don't assume the power operator's second operand is a constant.
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
Almost did the same thing...but I changed the trait bounds on
array_diff
to also require thatT
implement theCopy
trait.Then I used
iter
andcopied
instead of just usinginto_iter
like I should have...because I initially misspelledinto_iter
while trying this exact thing :Pcheck this
This comment is hidden because it contains spoiler information about the solution
It's funny how so few people have completed this kata when the description spells out the algorithm for you. I guess people find the math jargon intimidating and run away.
This comment is hidden because it contains spoiler information about the solution
In Rust, the description doesn't say the returned list needs to be in ascending order, but tests fail if it's not.
Upvoted for the single pass with early return algorithm :)
You can get rid of that awkward
Ord::cmp()
call by replacing.sorted_by
with.sorted_by_key
.Loading more items...