Blazing IASian
suppose we have a grid of 'a' horizontal lines and 'b' vertical lines.
we wish to go from one corner to the diagonally opposite corner along the diagonal.
how many squares do we cross?
the answer is pretty simple. try it!!!
Cool IASian
the greater one between a and b, right?
Hot IASian
the answer is a + b - gcd(a,b)...
gcd means greatest common divisor...