I’ve found this interview question at GeeksForGeeks and decided to actually code it in C++. The program currently prints the “value” of the horses (which is inaccessible by the coder so they can’t just look up who is number 1) and then proceeds to sort them and find the position of numbers 1,2 and 3 in a 5x5 matrix with the solution being a minimum of 7 races.
Here’s the Github repo: https://github.com/Shroomerian/HorseRacing
Thank you. Also about point number 1, I realized that the
rand()
function is actually part of<cstdlib>
and not<random>
so it turns out I included it for nothing.