Aggresive Cow Problem how to deal with these cases please help me out

2 <= N <= 100,000
0 <= xi <= 1,000,000,000
2 <= C <= N
i can find aproch but due to this cases i am unable to perform all test casses.

hello @mohsin_khan
try to solve it using binary search.

i am unable to understand these constraints what it means??

@mohsin_khan
constraints just explains the possible values a parameter can take.

for example here ->
2 <= N <= 100,000
0 <= xi <= 1,000,000,000
2 <= C <= N

N is array size , so by condition 2 <= N <= 100,000 they are saying that size of array can be in between 2 and 1000 000

1 Like

Thank You Sir and One More Doubt is for test cast we can write as
int t;
cin>>t;
while(t>0)
{
xyz task;
t–;
}
is this approach is fine or not ?? if no please tell me how to deal with this situation

yeah its fine .

int t;
cin>>t;
while(t--)
{
   xyz task;

}

this one also work

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.