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
Problem Comments
-
2 Comments
Christian Schröder
on 4 Mar 2023
The problem description is a bit unclear. Suppose that x = [70 71 73 74 73 70 72]. Then golfer #7 has the third best score; but since there's two golfers tied for first place (#1 and #6) and we're supposed to imagine a play-off then, I would suspect that the correct answer here is actually 2 rather than 7. Would be nice to get a clarification.
ChrisR
on 9 Sep 2023
Yes, that's correct. The order would be 70a, 70b, 71, so the golfer with 71 would be third and win.
Solution Comments
Show commentsProblem Recent Solvers19
Suggested Problems
-
26811 Solvers
-
1123 Solvers
-
middleAsColumn: Return all but first and last element as a column vector
601 Solvers
-
541 Solvers
-
170 Solvers
More from this Author271
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!