Created
November 13, 2020 14:04
-
-
Save alireza-mpr/98eea82e18a8d42e15ccac7ff9cdd7b6 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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