Largest subset DP with Bitmasking

what my approach here is that i am checking for all the elements currently pushed into the array for coprime.
if any one do not contribute then I break the loop
one of the test cases is giving wrong answer
pls check

@avinashmallik2017,
But why are you trying to do it greedily, for instance, it maybe the case that not including a[0] would result in larger subset. This problem can’t be done greedily, try thinking of brute force.