Ready to practice?
The AI interviewer will ask you all 1 questions with real-time feedback.
easy
coding
Closest Number
Created by Smart Mock Interview
Given two integers n and m (m != 0). The problem is to find the number closest to n and divisible by m. If there is more than one such number, then output the one having the maximum absolute value.
Interview Questions
- Find the number closest to n and divisible by mcoding
Example: Input: n = 13, m = 4 Output: 12 Explanation: 12 is the Closest Number to 13 which is divisible by 4.
Constraints: -105 ≤ n, m ≤ 105