Sunday, 18 August 2013

Number of integers in the range divisible by k

Number of integers in the range divisible by k

I have an array of numbers and I need to find all the integers in a given
range (a to b) that are divisible by a given number k.
I know the basic brute force solution for it but since the number of
queries can be large, I need an optimized answer if possible.
Is it possible with a segment tree?

No comments:

Post a Comment