Aggressive Cows (Max Distance): Place k cows in stalls to maximize the minimum distance between any two cows.
Leetcode 774. Minimize Max Distance to Gas Station
Given positions of existing gas stations and a budget k of new stations to add, place the k stations to minimize the maximum distance between adjacent stations on the line. This is typically solved by binary-searching the minimum possible maximum gap (a real value) and greedily checking whether that gap can be achieved by counting how many new stations each interval needs.
Onde essa pergunta já apareceu
Use esses exemplos para entender em que contexto ela costuma cair e adaptar sua prática.
Materiais associados
Nenhum anexo público associado a esta pergunta.
Depois de treinar essa pergunta, vale abrir outras do mesmo tipo e da mesma senioridade para comparar padrões de resposta.
Isso ajuda a sair da memorização de uma resposta só e entrar em repertório real de entrevista.
Continue a preparação com o banco completo
No app você encontra perguntas parecidas, compara empresas e aprofunda essa busca com mais filtros.