Ad
  • Default User Avatar

    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.

  • Default User Avatar

    Is it possible that your function is returning a string rather than an array? That would explain the part of the error message: for 2nd argument std::string.

    I'm marking this as resolved. I don't think it a kata issue.

  • Default User Avatar

    Can you please describe what you did that led to this error? When I test everything it works fine. Also, other people have solved the kata in C++ without encountering this issue.

  • Default User Avatar

    In C++ programming language, code shows std::vector<std::vector<int>> as a result when test expects std::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 the std::vector<std::vector<int>> type.

  • Default User Avatar

    Upvote just for the cat.

  • Custom User Avatar

    I'm sure most people who clicked best practice or clever were clicking it because that's funny, they're the kind of answers that are like: if it works, then it works.

  • Default User Avatar

    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.

  • Default User Avatar

    Because this make sanse for those who learn c++.

  • Default User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Default User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Default User Avatar

    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.

  • Default User Avatar

    Not as simple nor readable as could be.

  • Default User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Default User Avatar

    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.