diff --git a/E_1979_FindGreatestCommonDivisorofArray.java b/E_1979_FindGreatestCommonDivisorofArray.java new file mode 100644 index 0000000..d11a2ee --- /dev/null +++ b/E_1979_FindGreatestCommonDivisorofArray.java @@ -0,0 +1,18 @@ +class Solution { + public int findGCD(int[] nums) { + int min=1001; + int max=0; + int ebob=1; + for(int i=0; imax) + max=nums[i]; + } + for(int i=1;i<=max && i<=min; i++){ + if(max%i==0 && min%i==0) + ebob=i; + } + return ebob; + } +} \ No newline at end of file