int solution(int A, int B, int K) { // write your code in C++14 (g++ 6.2.0) //0 to b - 0 to a => a to b int c = (B/K)-(A/K); //check if divisible if(A%K==0) { c++; } return c; }
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter