Created
November 9, 2019 09:10
-
-
Save ishashankkumar/45a7bcc3d186c2acfb121cdfe63d069b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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