7 kyu

The Mark of Zorro

Description
Loading description...
Arrays
Algorithms
View
AllIssues4QuestionsSuggestions1Show Resolved
  • Please sign in or sign up to leave a comment.
  • 4500zenja1 Avatar

    Fork with fixing the return value for the first example (resolving this issue)

  • yLaWy Avatar

    The first example in the description is wrong, it should return {'a', 'b', 'c', 'e', 'h', 'k', 'n', 'o', 'p', 'q'}

  • Unnamed Avatar

    The constraints on types aren't clear. For example, are the matrix and row types indexable (or the can be something like a linked list), should the output use the same container type as either of the input types or not?

  • Voile Avatar

    You're using templates incorrectly. template <typename T, typename M> T zorro(const M matrix) is not a meaningful usage of template, it does not display anything in common between T and M, or what T and M can do. Basically zorro<int, std::string>("oh no") is also a valid usage of the template, but the code will explode as it assumes T and M are std::vector<T> and std::vector<std::vector<T>> respectively.

    If you're using templates, use it correctly. It should be template <typanem T> std::vector<T> zorro(const std::vector<std::vector<T>> matrix).

  • Voile Avatar

    std::vector<std::vector<std::string>> matrix { { } }; Should return { }

    [] and [[]] are completely different things; the former is 0x0 and the latter is 1x0, which is not a square.