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.
This comment is hidden because it contains spoiler information about the solution
Woops the formatting is botched, my bad
I only saw your reply when I posted mine and the page refreshed. At least you got a second confirmation.
Is 44 your answer or the expected answer ? Because 39 seems correct to me.
13 + 21 + 5 = 39
In
assert_eq!(...)
, when the two values compare unequal, the macro needs to print them and does so with the Debug trait.You can take a look at the signature of
assert_failed
in core::panicking.Approved some time ago
Approved
Approved
The point of this kata is not to write a function
boolean isDiv5(String s)
, but to create a regular expression that will match all strings that represent in binary a number divisible by five and only these strings.For example, this regular expression should match
"101"
,"0"
and"1111"
because they represent5
,0
and15
.But it should not match
"111"
,"10000"
nor"1"
as they represent7
,16
and1
.You mad genius
This comment is hidden because it contains spoiler information about the solution
Approved
Approved
You are doing WAY too much work generating all the permutations. Let's take the example in the description :
The whole list of permutations of "abc" is
["abc", "acb", "bac", "bca", "cab", "cba"]
, and the answer is"bac"
.Do you really need to know that
"abc"
comes before"acb"
to determine the middle permutation ? No you don't.Do you even need to generate them ? Once again, no you don't. After all,
'a'
is the very first letter in order, so there's not much chance for it to be the middle permutation's first letter.It's really quite simple, actually : look at the fork.
Edit : similar solution (except that I used 128 instead of 1000)
Loading more items...