Getting TLE in half of the test cases

https://ide.codingblocks.com/s/189088

How can I decrease the time complexity.If I use seives then its gonna increase the space complexity quite allot since the number can be INT_MAX

Hey @manit123
You need to use sieve. But not upto INT_MAX. We only need to consider prime numbers upto INT_MAX^(0.5) because factors can be found uptil root of value.

If your doubt is resolved please mark it as closed.

In my program I’m kind of using sieves itself in order to find the prime factors ,I’m not using brute force .

Found My error . You can mark this doubt resolved.

1 Like