Scala, Explained by by Chinese remainder theorem additive property
Additive property: if a==f (mod d), b==f (mod d), then it must be true that (xa + yb)==f (mod d)\n\nSo when we think of (xa + yb) mod d, and set the f ==0, then
Additive property: if a==f (mod d), b==f (mod d), then it must be true that (x*a + y*b)==f (mod d)\n\nSo when we think of (x*a + y*b) mod d, and set the f ==0, then, there must be k=[1...d-1] ranges, which can map (x*a + y*b)/k to this range. Thus there must be a (x\'*a + y\'*b)==1 always existed. \n\n\n```\n  def isGoodArray(nums: Array[Int]): Boolean = {\n    var res = nums(0)\n\n    def gcd(a: Int, b: Int): Int = {\n      if (b == 0) return a\n      gcd(b, a % b)\n    }\n\n    for (i <- 1 to nums.length - 1) res = gcd(res, nums(i))\n    res == 1\n  }\n```
[]