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.
It's good that this errored because this means the tests were using the user's submission solution as the reference solution, which is dangerous
that answer is from way before chatgpt was a thing lol
This comment is hidden because it contains spoiler information about the solution
It's bad practice to remove them. It's relying on the tests to include them instead, which leaves these solutions prone to being automatically invalidated in the future if the tests change and their solutions don't compile anymore. The line or two saved by omitting them isn't worth that risk, so you're doing good by keeping them in
I've left TypeScript for a year, and this was my return to form to it after flirting with C++'s metaprogramming instead and oh boy. TypeScript's type manipulation is both lightyears ahead and lightyears behind other languages. This was one of the most frustratingly entertaining exercises on this website, 10/10
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
Weird extra unnecessary step is expected. Adds nothing to the task.
JS Fork to address this suggestion. Also fixes description, increases documentation, and adds very minor test enhancements
This comment is hidden because it contains spoiler information about the solution
Consider storing the user's answers in
constexpr
variables then using the regularAssert::That
syntax instead ofstatic_assert
s. This way, the program still checks compile time behavior, but can still compile and provide meaningful feedback (viaExtraMessage
) instead of just refusing to compile and giving a vague assertion failure message.It's a variable template. In this particular case, making it not a function probably forces more creative solutions
An answer two years too late, but your code returns the incorrect result when T is
unsigned
. Thevs
function is where the problem lies.C++ Translation
The anticheat tests are incorrect and fail the reference solution too.
isUniversal
anticheat: This line ingenerate
Will incorrectly cause unconditional failure for some test cases. For example, if your random tests run
new FunctionalSet([D]).difference(new FunctionalSet([D]).difference(new FunctionalSet([C]))).not()
(which should, in fact, be universal).For the anticheats, the variables in the tests are scoped in a problematic way (namely
your_result
,my_result
and_it
). By scoping them outside the test loop, every singleit
block will be reading and writing to/from the same references. This is a problem because Chai sets up the fixtures way before any of theit
blocks are run. Before anyit
is run, these variables would have had their values overwritten on each loop, until they settle on the values from the final iteration. So the end result is basicallyyour_result
,my_result
and_it
having the same values on each run. Since the titles of theit
blocks are also precomputed, they do NOT match what is really being tested.The anti cheating memoization test: The functional set argument returns a string instead of a boolean. Discussed in the issue below mine by Invariance.
Loading more items...