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.
Ooh, dam… Yeah, I haven't coded in C++ for quite a while, I was absolutely sure arrays work like vectors in terms of pre-initialization (vectors are initialized to default values). Thank you!
You still misunderstood me here: I did copy all 10 of the tests, that's the main point of confusion.
The problem here (with uninitialized values) are the compiler settings. Although, it is still weird that I'm not seeing this, because I'm running locally with
-fsanitize=address,undefined
, so I should've gotten a warning about uninitialized values. Weird…Sorry, there seems to be misunderstanding. Let me clarify: the task has "basic" and "random" tests. There are 10 "basic" tests, and you can copy them. The tests are just "run function with exact input and compare to the expected output". That is to say:
It's impossible to "run them differently", at least not by mistake. There nothing to "run differently", there is exact single input and exact single output.
I mean, I have copied "basic tests" and ran them locally. They all return the expected results. There may be a flaw in my solution, but what I see here is that site result is different from my result on the same input, which is a problem with the site.
There seems to be a bug: after sending solution it says no tests are passing, but then if I copy the "basic tests" and run with the same code on my computer, I get the answers tests expect. It would seem like site has cached my wrong code (I had mistakenly used
a == b == c
in C++, forgot it doesn't work that way there, changed toa == b && a == c
), and despite it showing the correct code it apparently runs the older incorrect version…?