C++ translation kumited. Feel free to review and approve it when you get some time.
I'm stuck on this kata for a while. Can anyone give me a small hint?
C++ translation kumited.
OK, I will try to improve my solution. However, there is a set of fixed tests with a vector of 10 millions numbers. The fourth test has no solution pair and my current solution does not time out and return an empty vector.
Mostly looks good, but your solution does a linear lookup in tested_int, so it has quadratic complexity in the worst case and times out even with 100000 numbers if there's no pair. There are no such tests in other translations, so the tests are probably OK for now, but the solutions should better be fixed.
(And it's a shame C++17 isn't available, std::optional<std::pair<int, int>> would be much better.)
I moved the includes and using namespace in the appropriate sections. I also added random tests (although the other approved translations do not have any). Let me know if this is OK.
includes and using namespace in the preloaded section isn't a good thing. The solution shouldn't rely on contents of preloaded.
Random tests needed.
It should be just long.
I changed the range to (9.9e6 ; 10e6)
I change the type of the arguments to unsigned int.
I deleted the code in the preloaded section.
I took it out.