878-Nth-Magical-Number
Fri 14 November 2025
https://leetcode.com/problems/nth-magical-number
import pyutil as pyu
pyu.get_local_pyinfo()
print(pyu.ps2("python-dotenv"))
from typing import List
class Solution:
def nthMagicalNumber(self, n: int, a: int, b: int) -> int:
lcm = a * b // math.gcd(a, b)
l = min(a, b)
r = min(a, b) * n
while l < r …Category: leetcode
Read More