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.
Thanks for this kata.
I think the test has a serious deficiency: it does not check if the solution contains the smallest possible numbers, although this condition is stated in the problem description. Please modify the test or the description.
This comment is hidden because it contains spoiler information about the solution
I can't even solve this with pen and paper. Am I stupid or is this a very difficult one?
Any hints to get started?
My two cents: this would do very well as a performance kata. Maybe push the upper bounds for num up to 50 or so or add many, many, many more tests. Just a thought. Solid kata idea either way.
Insufficient test coverage causing such solutions to pass easily
|n/d - π| < eps
For eps==0.1, why would 16/5 be wrong?16/5 = 3.2
->|3.2 - 3.14159| = 0.058 < 0.1
This comment is hidden because it contains spoiler information about the solution
As the current tests goes, there is a serious lack of resolving power and lots of fractions between the input ranges are not tested at all (just look at my solution and ZED's solution).
The random tests does not cover every value of the entire range, so some solutions that fails at some particular values will still pass the tests, given some amount of submits.
If you don't want duplicates, you can always use a set to hold the values until the size is of a certain size, and then shuffle the result. Asymptotic complexity is just
O(n*log(n))
.Also, 50 tests are not enough, at least 500 or something is recommended for good coverage of the input range.
why the rounding? It has absolutely no point in the task. Use rather the proper assertion and reduce the length of the code allowed.
I have to admit, though, I'm clearly not fond of the idea (code length).