Actually I think there is a better method,by multiplying numbers from 1 to 333 to 3 we can find all multiples of 3 and then multiplying from 1 to 200 without considering multiples of 3( we've already counted them) to 5. this way we can change the iteration count from n (being the max number indicated) to n mod m ( m being the number we check, i.e 3 or 5) but overall both solutions have time complexity of O(n).
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Actually I think there is a better method,by multiplying numbers from 1 to 333 to 3 we can find all multiples of 3 and then multiplying from 1 to 200 without considering multiples of 3( we've already counted them) to 5. this way we can change the iteration count from n (being the max number indicated) to n mod m ( m being the number we check, i.e 3 or 5) but overall both solutions have time complexity of O(n).