You are viewing a single comment's thread. Return to all comments →
JS:
function gcd(a,b) { while(b !== 0) { const r = a % b; a = b; b = r; } return a; } function solve (x1,y1,x2,y2) { const yd = Math.abs(y2-y1); const xd = Math.abs(x2-x1); const a = Math.max(yd, xd); const b = Math.min(yd, xd); return gcd(a,b) - 1; }
Seems like cookies are disabled on this browser, please enable them to open this website
Sumar and the Floating Rocks
You are viewing a single comment's thread. Return to all comments →
JS: