Doubt in my code

Where am I going wrong. Please help !!

Hello @yashsharma4304 the way your initialising all the poistions in the array as 1 it will not be done like this.
the way you are doing will only mark position 0th as 1.


check this

1 Like

Ok so I was initialising the array p as

int p[1000005] = {1};

Here I was wrong.

Thank you for your support

@yashsharma4304 yes you were doing this mistake.

1 Like

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.

1 Like