I am subtracting the number of primes up to a - 1 from the number of primes up to b.
WA for prime visits
since the lower bound of range can be zero as well it will give garbage value/error when you’ll try to access freq[-1], you should include a max(0, a-1) inside.
Rectified code
1 Like