Given an array of 3 elements :- 2,4,5 and given a number n = 10 Find count of all numbers in the range 1 to n which are not dvisible by multiple of all array elements.
output:- 4 (1,3,7,9)
Any better approach brute force? n is in the range of 1 to 10^9
take a hashset and put all multiples of the arrayElements lesser than n and subtract the set size.