Determine the winner of a goofy golf tournament - MATLAB Cody - MATLAB Central

Problem 46573. Determine the winner of a goofy golf tournament

My brother and father were playing golf one day, and they caught up to a group that was part of a tournament. The group members explained that the tournament's rules were unconventional:
  • The golfer with the best score must have cheated, so that person is eliminated.
  • The golfer with the second-best score must have choked (definition, example), so that person is eliminated.
  • Therefore, the golfer with the third-best score wins.
Write a function that takes a vector of scores and determines the winner of this tournament (i.e., the number of the golfer with the third-best score). Remember that the objective in golf is to get a low score. You can assume that if two golfers tie for the best score, a playoff would separate them, and the player with the original second lowest score would win. If two golfers tie for the second-best score, eliminate them both. Let's ignore the possibility of a tie for third-best score; the organizers of the tournament probably had everyone figure it out at the 19th hole.

Solution Stats

35.19% Correct | 64.81% Incorrect
Last Solution submitted on Nov 10, 2023

Problem Comments

Solution Comments

Show comments
PIVlab surpasses 100K all-time File Exchange downloads
During the past twelve months, PIVlab, a MATLAB Community Toolbox for particle...
4
8

Problem Recent Solvers19

Suggested Problems

More from this Author298

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!