MeetCode
Count Multiples In Range
C
C++
Computer Mathematics
CSS
DSA
HTML
Java
JavaScript
NodeJS
PHP
Programming Interview
Python
ReactJS
SQL
Run
Submit
Dark
Problem Statement
Solutions
Submissions
Count Multiples In Range
Medium
Computer Mathematics
Integers & Divisibility
38 views
Explanation
Complexity
Problem Statement
Given L R k, count integers in [L,R] divisible by k.
Input Format
Three integers L R k.
Output Format
One integer count.
Example
Input
1 10 3
Output
3
Constraints
1
Input / Output Format
Input Format
Three integers L R k.
Output Format
One integer count.
Constraints
1
Examples
Input:
1 10 3
Output:
3
Example Solution (Public)
Computer Mathematics
Count = floor(R/k) - floor((L-1)/k). Use integer division.
Official Solution Code
Wrap
Copy
Count = floor(R/k) - floor((L-1)/k). Use integer division.
Please
login
to submit solutions.
Editor
C
C++
Computer Mathematics
CSS
DSA
HTML
Java
JavaScript
NodeJS
PHP
Programming Interview
Python
ReactJS
SQL
Test Cases
Output
Submission Result
Input
1 10 3
Expected Output
3
Compile Output
Error
Output
Please
login
to submit solutions.