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.
My issue is resolved.
it's not weird, it's because on VSC you do only one single test, so you don't actually see there is a state that is shared between different calls.
Best practice: as B1ts said, don't use global vars (unless you know exactly what you do and how to use them).
How about not using global vars at all? That's the easiest fix. An alternative is to reset all global variables at the start of function.
It was weird as my code with global vars works in VS Code but did not pass tests online. Can you recommend a good article to read how to use global vars correctly? Thanks.
Nope. Anyone can use global vars, but only if they know how to use them correctly. Problems with global vars aren't under the "responsability" of the kata/author, but under the reponsibility of the users (who do not know how to code properly with global vars, in that case).
I don't see "don't use global variables" in the instructions... May the instructions should be updated?
"don't use global variables" ?
My C++ solution compiles and passes tests, so kata setup seems to be OK. I believe that you either did not stick to the requested method signature, modified it, or left it empty and implemented your solution in some other class/method/function.
Does your solution implement
static std::string SumOfDivided::sumOfDivided(std::vector<int>& lst);
?