Circular Sum Test_case 3 to 5 is not working may you tell me where i am wrong

Your code is absolutely correct. Just try to avoid the checks you do for constraints. Constraints are only used to finalize the data type we can use for particular containers. For eg if it’s given that 0<=Ai<=10^18 this means array should be of long long int. If 0<=N<=1000 it should be of int data type. Rest everything is correct.

from where i can get an idea about it. because of this so many times, i stuck in this problem

Ask me, what issues you suffer?

1<=t<=100
1<=n<=1000
|Ai| <= 10000
generally i see this one as a if(t>=1 && t<=100)
{
if(n>=1 && n<1000)
{…so on}
genereally i think like this to solve constraints. i guess i am wrong in this way please correct me. how to deal with these type of issues

First of all you need not have to do this. If in the question it’s mentioned that n is less then equal to 1000 we will assume that all the test cases will follow this rule as told by problem setter in constraints.
Constraints have 2 main role. What data type we have to take. And what should be the time complexity of our function.
If it’s 10^3 - O(N^3) will work
10^5 -O(NlogN)
10^8 - O(N)
That’s it. And always keep an eye on constraints. At what size you have to make an array. As in this one, you have made array of 1000 but in question they said 10000. Small small things will give you right answer.

1 Like

Thank you So Much Sir
if Constraints are
n<1000; //n can be integer and o(n^3)
if(size of array <10000000//it means data type is integer and O(n) we have to solve am i right ??

It’s 10^8 , so it won’t be int. It will be greater then int. In order to be save, anything greater then int, declare it as long long int. Then you won’t care about the data type and secondly yes, if it’s 10^8 then it should be in O(N) time complexity. If more then that, then it should be in logarithmic time complexity. Also whenever you have issue with constraints. You can post a doubt. Anyone will help you regarding this. It’s minute but necessary for a beginner.

1 Like

great Sir Thank you So Much.
i got it
if value greater than 10^8 means we have to solve the problem in logn times
logn<n<nlogn<n^2<n^3;
10^18<10^8<10^5<…<<10^3
long long int <<long long int <<int <<int <<int
am i right ??

Right

Only the time complexity of respective size are in this order. That is for 10^18 logn
10^8 N
10^5 nlogn
10^3 N^3

Long long int >> long long >> double >> int.

1 Like

Thank you, sir, Good Night :slight_smile:

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.