Max Multiple
Given a divisor and a bound, find the largest integer N such that:
Nis divisible bydivisor.Nis less than or equal tobound.Nis greater than0.
It is guaranteed that such a number exists.
Example
For divisor = 3 and bound = 10, the output should be
max_multiple(divisor, bound) = 9The largest integer divisible by 3 and not larger than 10 is 9.
Solution
py
def max_multiple(divisor, bound):
return (bound // divisor) * divisor
print(max_multiple(3, 10))