[LeetCode] Count Collisions of Monkeys on a Polygon

1 · · Jan. 29, 2023, 3:52 a.m.
2550. Count Collisions of Monkeys on a Polygon There is a regular convex polygon with n vertices. The vertices are labeled from 0 to n - 1 in a clockwise direction, and each vertex has exactly one monkey. The following figure shows a convex polygon of 6 vertices. Each monkey moves simultaneously to a neighboring vertex. A neighboring vertex for a vertex i can be: the vertex (i + 1) % n in the clockwise direction, or the vertex (i - 1 + n) % n in the counter-clockwise direction. A collision h...