Search
⌘K

Leetcode 858. Mirror Reflection

Given a square room of side p and a laser from the southwest corner that first hits the east wall q units up, determine which corner receptor (0, 1, or 2) the ray will hit first after reflections. Algorithmically, this reduces to finding the smallest k with k*q divisible by p (via gcd/lcm) and using the parity of the resulting vertical/horizontal multiples to identify the receptor.


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Comments

Your account is free and you can post anonymously if you choose.