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.
This kata "assumes" that you should have OOP basic knowledge.
"Additionally, this Kata assumes that you have basic knowledge of Object-Oriented Programming ( or a similar concept ) in the programming language you are undertaking. If you have not come across Object-Oriented Programming in your selected language, you may want to try out an online course or read up on some code examples of OOP in your selected language up to ( but not necessarily including ) Classical Inheritance."
Although, this is not necessary because you don't need that. The language can be not object-oriented (like C) neither the algorithm requires and/or uses inheritance.
I suggest to remove this paragraph for better clarity.
In C++ programming language, code shows
std::vector<std::vector<int>>
as a result when test expectsstd::array<std::vector<int>, 2>
In file included from main.cpp:7:
./tests.cpp:4:29: error: no matching function for call to 'validateTwoSetsOfEqualSum'
auto verification = validateTwoSetsOfEqualSum(i, createTwoSetsOfEqualSum(i));
^~~~~~~~~~~~~~~~~~~~~~~~~
./preloaded.h:8:13: note: candidate function not viable: no known conversion from 'std::vector<std::vector >' to 'const std::array<std::vector, 2>' for 2nd argument
std::string validateTwoSetsOfEqualSum(int n, const std::array<std::vector, 2>& answer) {
^
1 error generated.
As a suggestion, change the code to return the expected value as a
std::array<std::vector<int>, 2>
in conformance with your test function or change your test function to expect thestd::vector<std::vector<int>>
type.Upvote just for the cat.
My intention was not to criticize you but, that is a really bad answer. An answer that I didn't ask for.
Even using other programming language, and the resulting code is by other programmers, the fact that people upvote to this is not good. Anyway, nothing can be done.
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
If you really want to learn, try to be positive as when you receive the feedback about the people comments. Clearly this is not a good solution.
Not as simple nor readable as could be.
This comment is hidden because it contains spoiler information about the solution
Not a critique to the author of the solution but, I don't know why people marked this kind of solutions as best practices or clever if it uses a lot of functions and a data structure that make the algorithm waste computational resources.