You are viewing a single comment's thread. Return to all comments →
Scala solution:
def gcd(x: Int, y: Int): Int = { val dev = Math.max(x - y, y -x) if (dev == 0) x else gcd(Math.max(dev,y), Math.min(dev,y)) }
Seems like cookies are disabled on this browser, please enable them to open this website
Computing the GCD
You are viewing a single comment's thread. Return to all comments →
Scala solution: