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

  • Double_A
    link
    fedilink
    English
    arrow-up
    3
    ·
    1 year ago

    I really hate those kind of questions. They mostly have nothing to do with coding, and are really just a mathematical puzzle. Also most people are not able to figure those out on their own, and then everyone just ends up memorizing things.