Skip to content
This repository was archived by the owner on Sep 22, 2021. It is now read-only.

Commit a29862a

Browse files
author
Alexey Ilyukhov
committed
Add 1250. Check If It Is a Good Array
1 parent af24296 commit a29862a

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
class Solution(object):
2+
def isGoodArray(self, nums):
3+
"""
4+
:type nums: List[int]
5+
:rtype: bool
6+
"""
7+
def gcd(a, b):
8+
if a == 0:
9+
return b
10+
if a > b:
11+
return gcd(b, a)
12+
return gcd(b % a, a)
13+
14+
return reduce(gcd, nums) == 1
15+

0 commit comments

Comments
 (0)