3 test cases are wrong,please help.
HCF problem hackerblocks
Hey Dhruv ! Can you post the Qn. link as well ??
The Qn. link is not working for me , post the question
Given N positive numbers, your task is to calculate their HCF.
if question is to find gcd of all elements of array then you are doing this wrong , you should do hcf=gcd(a[i],hcf);
for(int i=0;i<n-1;i++){
hcf=gcd(a[i],a[i+1]);
}
1 Like