Novo curso: Como conseguir vagas remotas em empresas que pagam $120k+/ano
NaGringa
CodingMid-level

Leetcode 2163. Minimum Difference in Sums After Removal of Elements

Given an array of length 3n, remove exactly n elements so the remaining 2n elements (split into the first n and last n) have the smallest possible difference between their sums. The challenge is to choose which elements to remove, typically solved by scanning possible middle split points and using heap-based prefix/suffix greedy computations to precompute the best n-element sums on each side and minimize their difference.

Empresas em que apareceu
AmazonAmazon
Contextos reais

Onde essa pergunta já apareceu

Use esses exemplos para entender em que contexto ela costuma cair e adaptar sua prática.

Amazonmidjan. de 2025

Maximizing Weighted Array Difference: Remove n/3 items from an array to maximize the difference between the sum of the first half and the sum of the second half of the remaining elements.

Anexos públicos

Materiais associados

Nenhum anexo público associado a esta pergunta.

Próximo passo

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.