You should check your Big O Notation (O) of your algorithm, if it is O(n^2) then your code will got an erro timed out.
The complex of algorithm should be O(n) or O(nLog(n))
It is simply returned by copy.
When the return occurs, the std::vector initialized in the test (invisible here) receives a copy of all elements of ret vector.
You should check your Big O Notation (O) of your algorithm, if it is O(n^2) then your code will got an erro timed out.
The complex of algorithm should be O(n) or O(nLog(n))
There's no such fixed test in JavaScript, and the random tests are correct.
That's not a kata bug, it's your code's problem:
Same bug here in C++, I've got a timeout.
Any addition might overflow/underflow, including operator +.
It is simply returned by copy.
When the return occurs, the std::vector initialized in the test (invisible here) receives a copy of all elements of ret vector.
The most elegant to me as it uses the pure mathematical definition of what are hours, minutes and second. And this also might be the most efficient.