You are expressly and emphatically restricted from all of the following:
selling, sublicensing and/or otherwise commercializing any Website material;
Codewars may be free ( as in beer ), but that does not mean it's not commercial.
That means any text or code you lifted from Codeforces cannot be used here.
The task itself is probably generic enough that is is uncopyrightable.
You should not shout out to Codeforces in the description;
you should write your own description text that does not even resemble theirs; and
you should write all your own code from scratch.
Please close this issue with an explicit message that you have tried to the best of your ability to not use anyone else's IP.
Note that I am not a Codewars or Andela employee, and certainly not a lawyer.
That's an issue, not a suggestion, and it's documented here.
Please read all applicable documentation, and test suites of your solved kata, and learn from that. ( If you solve more kata before publishing your own first kata, you could probably learn more from them. )
If you want a kata that can be solved somewhat naively, length 30 is too big.
If you want a kata that requires a clever solution, up to 30 is not big enough.
Runtimes currently vary too much, depending on the max length randomly chosen, so there are too few random tests as well and lengths are too random.
Returning inconsistent datatypes is not a best practice. If no subset exists, ask for null instead of -1 ( it's not an array either, but it's less bad as an optional array value ).
O(n*sqrt(n)*m) per entire test suite, where m is the number of tests isn't supposed to pass. Gotta reduce this somehow. Remember about the upper bound.
Random inputs are now guaranteed to consist of positive numbers.
It is theoretically possible for a random input to be [ 1 ], in which case closureGen([ 1 ])[999] is tested against undefined. This makes sense in the language; I'm not preventing this degenerate case.
"Your task is to write a generator function that generates the members of the closure of any given finite set of positive numbersS in ascending order."
https://codeforces.com/terms:
Codewars may be free ( as in beer ), but that does not mean it's not commercial.
That means any text or code you lifted from Codeforces cannot be used here.
The task itself is probably generic enough that is is uncopyrightable.
You should not shout out to Codeforces in the description;
you should write your own description text that does not even resemble theirs; and
you should write all your own code from scratch.
Please close this issue with an explicit message that you have tried to the best of your ability to not use anyone else's IP.
Note that I am not a Codewars or Andela employee, and certainly not a lawyer.
That's an issue, not a suggestion, and it's documented here.
Please read all applicable documentation, and test suites of your solved kata, and learn from that. ( If you solve more kata before publishing your own first kata, you could probably learn more from them. )
All the issues actually mean I like the kata and think it's worth fixing.
I checked; it's not a duplicate unless you start requiring the performance to solve this.
Deciding whether you want https://www.codewars.com/kata/reviews/6878d857df9d7a7bc5db625f/groups/687a350c17df87835895859e or https://www.codewars.com/kata/reviews/6878d857df9d7a7bc5db625f/groups/6878e401290937e7b94a719b to be a solution is up to you, but you will have to specify, and tailor the test sizing to, that decision.
Do not use the legacy test framework. Use Chai.
Also, do not
console.log
anything in testing, use headers and/or failure messages.This is currently a valid solution, because the validation doesn't check if a
-1
return is actually valid.If a solution exists,
-1
should not be accepted as valid.Not marking this as a spoiler, because it should very much be fixed before the kata is republished.
The input domain is either too small or too big.
If you want a kata that can be solved somewhat naively, length
30
is too big.If you want a kata that requires a clever solution, up to
30
is not big enough.Runtimes currently vary too much, depending on the max length randomly chosen, so there are too few random tests as well and lengths are too random.
Returning inconsistent datatypes is not a best practice. If no subset exists, ask for
null
instead of-1
( it's not an array either, but it's less bad as an optional array value ).Needs fixed tests with empty array, with
tot = 0
, and with both. At least one accepted solution returns a wrong answer for that.thank you! :)
Also, you might wanna search it up on wikipedia, if you don't succeed yourself. There's a nuance that could potentially not let you pass.
O(n*sqrt(n)*m) per entire test suite, where m is the number of tests isn't supposed to pass. Gotta reduce this somehow. Remember about the upper bound.
while my code is correct, i keep failing at test 10# on timeout.
is O(n*sqrt(n)) supposed to be good enough?
Random inputs are now guaranteed to consist of positive numbers.
It is theoretically possible for a random input to be
[ 1 ]
, in which caseclosureGen([ 1 ])[999]
is tested againstundefined
. This makes sense in the language; I'm not preventing this degenerate case."Your task is to write a generator function that generates the members of the closure of any given finite set of positive numbers
S
in ascending order."Yes,
0
is to be excluded. I'll fix it.The starting set generated in the random tests can include
0n
, and when that happens,refClosureGen()
generates only0n
values.For example,
take(10)(refClosureGen([3n,2n,0n]))
yields[0n, 0n, 0n, 0n, 0n, 0n, 0n, 0n, 0n, 0n ]
instead of[0n, 2n, 3n, 4n, 6n, 8n, 9n, 12n, 16n, 18n]
.The random tests in the Haskell version does not include zero in the starting set.
If zero is to be exculded from the starting set, I believe
range(1e4)
should be changed torange(1, 1e4, 1)
in the random tests.Loading more items...