@anand 100000 squared gives 10000000000. If you check the constraints, the prime number lies less than 10^9.
1 Like
@amol58 don’t use sets and map,you are increasing complexity by the factor of log(n), simple vector would work.i used set only to check unique. Check my solution above.
1 Like