Law 11: Difference between revisions
Jump to navigation
Jump to search
imported>Kmk21 Created page with "This problem gives the positions of all the players and ball on a soccer pitch and asks you to determine who is in an offside position. The algorithm for this problem is not..." |
(No difference)
|
Latest revision as of 23:01, 29 December 2017
This problem gives the positions of all the players and ball on a soccer pitch and asks you to determine who is in an offside position.
The algorithm for this problem is not difficult. One simply brute-force checks if players are
- on the opponents side of the field
- further than the second to last opponent
- further than the ball
The challenge is parsing the input. This becomes easy if one uses [,:\s+] as the input delimiter.