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.
Haskell translation
Python fork
Haskell fork
This fork fixes a few issues:
shouldBeApprox
instead ofshouldBe
Float
toDouble
Regarding the type change, double precision floats are needed as the order of summation on single-precision floats can differ by amounts greater than the tolerance needed by
shouldBeApprox
.For example:
This comment is hidden because it contains spoiler information about the solution
The description states that the input should be an NxM array, but the random tests for Python can produce arrays with rows of differing lengths.
The tests should limit the imports from the solution to only those being tested, as any defined helpers may clash with names in the tests.
I appreciate the use of
fix
, but doesn't using(++)
inappend'
kinda defeat the purpose?Python: No random tests
Even though the tests don't test for this, you should probably replace
'|'.join(forbidden_words)
with
'|'.join(map(re.escape, forbidden_words))
to avoid errors if any word in
forbidden_words
contains regex metacharacters.While it's not the simplest, I'm proud of the time complexity of my solution. Once the trie is populated, each call of
check1800
runs in constant time, since phone number length is constant.Randomized testing in Haskell (and maybe other languages) can result in the following:
The description lacks enough detail to determine sorting behavior between letters and characters whose ASCII value falls between the upper and lowercase letter ranges:
[\]^_`
This comment is hidden because it contains spoiler information about the solution
I've forked the Haskell translation here to add random cases and clean a few things up.
Sample tests in Haskell fail due to a faulty function signature. I've put in a translation here that fixes it.
(?)
in sample tests.Loading more items...