We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
We choose some divisor d and check whether we can divide all of the numbers in a set A. If we can divide all of the numbers, then we cannot choose any of them.
The loop "for (int a : s)" goes through the set A and counts how many of the elements of that set are divisible by d.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Sherlock and GCD
You are viewing a single comment's thread. Return to all comments →
Thank you!
We choose some divisor d and check whether we can divide all of the numbers in a set A. If we can divide all of the numbers, then we cannot choose any of them.
The loop "for (int a : s)" goes through the set A and counts how many of the elements of that set are divisible by d.