Skip to content

Instantly share code, notes, and snippets.

@alireza-mpr
Created November 13, 2020 14:04
Show Gist options
  • Select an option

  • Save alireza-mpr/98eea82e18a8d42e15ccac7ff9cdd7b6 to your computer and use it in GitHub Desktop.

Select an option

Save alireza-mpr/98eea82e18a8d42e15ccac7ff9cdd7b6 to your computer and use it in GitHub Desktop.
function solution(A, B, K) {
// write your code in JavaScript (Node.js 8.9.4)
if(K==0) return 0;
const a = Math.floor(A/K);
const b = Math.floor(B/K);
if(a==0 && b==0 && B != 0)
return 0;
let between = b - a;
if(A%K==0)
between++;
return between;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment