Aggressive cows spojj?

Hello @Shreya-Gupta-2383169445069382,

  1. How would the following statement will give the value of end i.e. e?
    e=a[n-1]-a[0]
    Solution:
    Sort your array as it is the question of binary search.
    and then take e=darr[n-1]+1 as end

  2. Why are you taking value of test cases i.e. t?
    There is no such input for the question in your course.

rest all seems correct.

Hope, this would help.
Give a like if you are satisfied.

The values are already sorted. And test cases are given in spoj.
E is the max distance possible between 2 cows which is a[n-1]- a[0]

Hello @Shreya-Gupta-2383169445069382,

  1. So, after submitted my code on spoj.
    I got to know that the array is not sorted as it not even specified in the question either.

  2. You have not taken the constraints into account.
    int might not work for all the variable.

Let me know if you still face any issue.

Thanks that helped :blush::blush::blush:

Anytime @Shreya-Gupta-2383169445069382,

Please, mark it as resolved.