858-Mirror-Reflection

Sat 17 May 2025

https://leetcode.com/problems/mirror-reflection

import pyutil as pyu
pyu.get_local_pyinfo()
print(pyu.ps2("python-dotenv"))
from typing import List
class Solution:
  def mirrorReflection(self, p: int, q: int) -> int:
    while p % 2 == 0 and q % 2 == 0:
      p //= 2
      q //= 2

    if p % 2 == 0:
      return 2
    if q % 2 == 0:
      return 0
    return 1
new Solution().mirrorReflection()

Score: 5

Category: leetcode