← Back

πŸ„ Cow Territory Challenge

Aggressive Cows - Maximize Minimum Distance

Stalls

-

Cows

-

Min Distance

-

Best Answer

?

Steps

0
Binary Search on Minimum Distance
Range: [-, -] | Testing: -
Checking...
🌾 The Farm Stalls 🌾
Generate a farm to place aggressive cows!

πŸ“– Aggressive Cows

Problem: Place C cows in N stalls to maximize the minimum distance between any two cows.

Binary Search: Search on the answer (minimum distance). Range: [1, max_pos - min_pos]

Feasibility: Greedily place cows. If we can place all C cows with at least D distance, D is feasible.

Time: O(N Γ— log(range))