Sieve hacker blocks prime visit

why my code show run time error

let me help to correct my code

@kshitiz.gzb

  1. Use long long int for loop counter variables i and j
  2. Increase the size of n to 1000000 as per problem constraints.
  3. In Line No. 25 , check for sieve [ i ] instead of sieve [ i - 1 ].
  4. Run your loop till n , not till 10 ( Line No. 11 ).
1 Like

Thanks for the help you are one the best ta

@kshitiz.gzb
Thanks. Glad I could be of help.
If your issue is solved , I request you to mark your doubt as resolved in your Doubts Section.
If you need any other help regarding your doubt , let me know.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.