1. Aggressive Cows #

Created Monday 22 June 2020

The solution: Observations: The minimum number of cows possible are two:

  1. The range of distance is 0(all in one stall) vs x~max ~- x~min~(only 2 cos present) - This is true for any input.
  2. To find out Largest minimum distance, we need to be able to arrange the cows with gaps of atleast that value.
  3. Suppose we are at the answer, d, we can arrange the cows where atleast one distance is d.
  4. For d+1, we won’t be able to arrange the cows, not enough stalls.
  5. For d-1, we should still be able to arrange the cows, because stalls are remaining.
  6. This means that starting from the ends is a waste of time. We can instead start in the middle.
  7. The middle of what? If we just take the case of 2 cows. The solution works out in ClogD. Remember we are sorting. So the solution is nlon.
  8. Is a better solution possible - maybe. But this is it for now.