반응형
Given a divisor and a bound, find the largest integer N such that: N is divisible by divisor. N is less than or equal to bound. N is greater than 0. It is guaranteed that such a number exists. Example For divisor = 3 and bound = 10, the output should be maxMultiple(divisor, bound) = 9. The largest integer divisible by 3 and not larger than 10 is 9. |
code>>
int maxMultiple(int divisor, int bound) {
return bound / divisor * divisor;
}
반응형
'알고리즘 > codefights' 카테고리의 다른 글
7>lateRide (0) | 2018.05.19 |
---|---|
6>circleOfNumbers (0) | 2018.05.19 |
4>seatsInTheater (0) | 2018.05.19 |
3>candies (0) | 2018.05.19 |
2>largestNumber (0) | 2018.05.19 |