I really don’t understand why my answer is wrong, it works just fine for me. Could someone please help?
Your code doesn’t print anything for N = 1000000.
The constraint is 1 ≤ N ≤ 1000000 but u r not considering the case where N = 1000000…
The constraint is on the input that input is N<=1000000 , not the answer . Answer can be greater than 1000000 .