horse interview questions

When I loaded YouTube recently, one of the suggested videos was entitled “How To Solve Google’s 25-Horses Interview Question” by MindYourDecisions. The video cover contained the text:

I did not watch the video since I thought this might be a fun exercise in BASIC. Instead, I fired up the excellent XRoar emulator and began writing a simple program that raced horses.

Next I initialized the array with a unique speed value by simply going through the loop and assigning each horse a speed of 0 to 24:

My next step was to randomize the entries, so I looked back on an earlier article I posted about Random BASIC shuffling. I implemented the suggested from James Jones to swap values in this array:

Now I had an array of 25 horse speeds — H(0) to H(24) — that contains a random selection of values 0 (slowest) to 24 (fastest).

If you wanted to just find the fastest horse, you could simply scan the array and remember the fastest entry you found. At the end of the scan, you know the fastest horse. Something like this:

…but since this question requires racing no more than five horses at a time, I had to split that up in to code that would run five races of five horses, then a sixth race that raced the winners of each of the five races.

This is not the solution to the question, but it was a fun exercise. Here is the messy program I came up with. It will first print out the speeds of all 25 horses (five per line, matching how they will be raced) and then run the five races and final race of the winners:

And the result (also messy) looks like this: Color BASIC program to find the fastest of 25 horses, when racing no more than five at a time.

The question was what is the fastest way to find the fastest three horses. I found the fastest by running six races. I expect the solution is simple, but I do not know it.

I thought I’d share this here and see if anyone else wants to work on it.

How To Solve Google’s 25 Horses Interview Question

Software Engineer ‍ Blogger Plant Dad https://linktr.ee/mattcroak

Let’s say that you have 25 horses, and you want to pick the fastest 3 horses out of those 25. In each race, only 5 horses can run at the same time because there are…

The 25 Horses Puzzle is a popular question that has been used by Google and other tech companies in interviews to evaluate a candidate’s ability to solve problems. It involves no code, but is a good test of logic and association. Here’s the question:

About Me: Presh Talwalkar

I run the MindYourDecisions channel on YouTube, which has over 1 million subscribers and 200 million views. I am also the author of The Joy of Game Theory: An Introduction to Strategic Thinking, and several other books which are available on Amazon.

(As you might expect, the links for my books go to their listings on Amazon. As an Amazon Associate I earn from qualifying purchases. This does not affect the price you pay.)

By way of history, I started the Mind Your Decisions blog back in 2007 to share a bit of math, personal finance, personal thoughts, and game theory. Its been quite a journey! I thank everyone that has shared my work, and I am very grateful for coverage in the press, including the Shorty Awards, The Telegraph, Freakonomics, and many other popular outlets.

I studied Economics and Mathematics at Stanford University.

Feel free to send me an email [email protected]. I get so many emails that I may not reply, but I save all suggestions for puzzles/video topics.

If you purchase through these links, I may be compensated for purchases made on Amazon. As an Amazon Associate I earn from qualifying purchases. This does not affect the price you pay.

Book ratings are from January 2022.

(US and worldwide links) https://mindyourdecisions.com/blog/my-books

Mind Your Decisions is a compilation of 5 books:

The Joy of Game Theory shows how you can use math to out-think your competition. (rated 4.2/5 stars on 224 reviews)

40 Paradoxes in Logic, Probability, and Game Theory contains thought-provoking and counter-intuitive results. (rated 4.1/5 stars on 38 reviews)

The Irrationality Illusion: How To Make Smart Decisions And Overcome Bias is a handbook that explains the many ways we are biased about decision-making and offers techniques to make smart decisions. (rated 4/5 stars on 24 reviews)

The Best Mental Math Tricks teaches how you can look like a math genius by solving problems in your head (rated 4.2/5 stars on 76 reviews)

Multiply Numbers By Drawing Lines This book is a reference guide for my video that has over 1 million views on a geometric method to multiply numbers. (rated 4.3/5 stars on 30 reviews)

Mind Your Puzzles is a collection of the three “Math Puzzles” books, volumes 1, 2, and 3. The puzzles topics include the mathematical subjects including geometry, probability, logic, and game theory.

Math Puzzles Volume 1 features classic brain teasers and riddles with complete solutions for problems in counting, geometry, probability, and game theory. Volume 1 is rated 4.4/5 stars on 87 reviews.

Math Puzzles Volume 2 is a sequel book with more great problems. (rated 4.1/5 stars on 24 reviews)

Math Puzzles Volume 3 is the third in the series. (rated 4.2/5 stars on 22 reviews)

Teachers and students around the world often email me about the books. Since education can have such a huge impact, I try to make the ebooks available as widely as possible at as low a price as possible.

Currently you can read most of my ebooks through Amazon’s “Kindle Unlimited” program. Included in the subscription you will get access to millions of ebooks. You don’t need a Kindle device: you can install the Kindle app on any smartphone/tablet/computer/etc. I have compiled links to programs in some countries below. Please check your local Amazon website for availability and program terms.

Grab a mug, tshirt, and more at the official site for merchandise: Mind Your Decisions at Teespring.

…but since this question requires racing no more than five horses at a time, I had to split that up in to code that would run five races of five horses, then a sixth race that raced the winners of each of the five races.

When I loaded YouTube recently, one of the suggested videos was entitled “How To Solve Google’s 25-Horses Interview Question” by MindYourDecisions. The video cover contained the text:

Now I had an array of 25 horse speeds — H(0) to H(24) — that contains a random selection of values 0 (slowest) to 24 (fastest).

I thought I’d share this here and see if anyone else wants to work on it.

If you wanted to just find the fastest horse, you could simply scan the array and remember the fastest entry you found. At the end of the scan, you know the fastest horse. Something like this:

Interviewers may ask this question to learn more about your experience working with challenging horses. Use examples from your past where you had to work with a horse that was aggressive, anxious or otherwise difficult to train. Explain how you used your skills and knowledge to help the animal overcome its behavioral issues.

Example: “In my last position as a trainer, I worked with a thoroughbred racehorse who was very anxious. The horse would often become nervous when it entered the track for training and sometimes even during races. To help calm the horse down, I started by spending extra time in the barn with the animal before taking it out to the track. This helped me build a stronger bond with the horse so it felt more comfortable around me. Eventually, the horse became less anxious overall.”

Example: “I’ve encountered this situation before at my previous job. The first thing I did was try to determine what caused the horse to become afraid. I looked for any changes in the environment or other horses that could have triggered the behavior. Once I determined there were no environmental factors causing the fear, I worked with the owner to help them understand why their horse was suddenly acting differently. We then developed a training program to help the horse overcome its fear.”

Example: “I try to understand why the horse is being stubborn or uncooperative, which helps me figure out what I need to do to get them to cooperate. For example, if they’re being stubborn because they don’t want to work, then I will take a break from training until they feel more comfortable. If they’re being stubborn because they’re scared, then I will spend some extra time with them to help them feel more confident.”

Example: “In my last role as a horse trainer, I worked with two other trainers who also trained multiple horses at the same time. We would often work on different aspects of our horses’ training while still supporting each other. For instance, one day we were all working on teaching our horses to back up. One of us was focused on getting the horse to move backward by pulling its reins, another was focused on moving backward when it heard a whistle and I was focused on backing up when someone patted its side.”

FAQ

How do you prepare for a horse interview?

Tell potential employers about yourself. Add all your work history, including part time work, voluntary work, work experience programs etc. Include your start and end dates, where you worked, your job title, what you did and why you left. Include non-equine jobs you’ve done.

Can you solve the 25 horses puzzle Google interview question?

To find the fastest, you need to run all 25 horses at least once, and since you can only race 5 horses at a time, you need a minimum of 25/5 = 5 races. Then you need to compare the winners of these races, which means a 6th race is necessary.

How many race do you need to figure out top 3 out of 25 horses one race consist of 5 horses and their ranks are unique no ties?

of races which are required to get the top 3 horses. The solution is 7. First, we group the horses into groups of 5 and race each group in the race course.

What is the minimum number of races required to find top 3 horses from 25 if there are only 5 lines?

This means we can just have a clean race and find the second and third fastest horse. So overall, the answer is 7 races!

Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *