CountDiv 100% Solution inJavascript
Question
My Solution (O(1))
function solution(A, B, K) { // find the smallest multiple of K (A or above) let minKsMult = Math.ceil(A/K)*K; // there's none if (minKsMult > B) return 0; else return Math.floor(B/K)-Math.ceil(A/K)+1; }