Skip to content

Instantly share code, notes, and snippets.

@ishashankkumar
Created November 9, 2019 09:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ishashankkumar/45a7bcc3d186c2acfb121cdfe63d069b to your computer and use it in GitHub Desktop.
Save ishashankkumar/45a7bcc3d186c2acfb121cdfe63d069b to your computer and use it in GitHub Desktop.
# This is not my solution, the snippet is copied from the link below.
# https://leetcode.com/problems/check-if-it-is-a-good-array/discuss/419368/JavaC%2B%2BPython-Chinese-Remainder-Theorem
def isGoodArray(self, A):
gcd = A[0]
for a in A:
while a:
gcd, a = a, gcd % a
return gcd == 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment