First test case failed its saying time limit exceeded but when i m doing it on other ide it is running perfectly. Can you tell me where i am doing it wrong ?
Link to my code is ide.codingblocks.com/#/s/13455
Prateek loves candy problum
hey vaibhav ! ur code must need optimisation that’s why you are gettting TLE verdict .
Hint -> Use Sieve of eratosthenes .
If you still find difficulty go through ur modified code http://ide.codingblocks.com/#/s/13468
Hie, plz tell solution of same problem without using array
Using array of constant size won’t affect the complexity of program in any way.
So it is fine to use the array…
this question is given in challenger fundamentals problems where we haven’t reached till array and functions. so i want to solve it by only those concepts which i have learnt till those problems.
Please send the link to the question.
If the constraints mentioned in question are small, then it may be possible to solve it without using arrays. But otherwise, it may TLE.
Actually arrays come under fundamental concepts only. So it might be required that you can use array in the question.