Skip to content

2163. Minimum Difference in Sums After Removal of Elements #1942

Answered by mah-shamim
mah-shamim asked this question in Q&A
Discussion options

You must be logged in to vote

We need to find the minimum difference between the sums of two equal parts of an array after removing exactly n elements from the original array of size 3n. The remaining 2n elements are divided into two parts: the first n elements and the next n elements. The difference is calculated as the sum of the first part minus the sum of the second part.

Approach

  1. Problem Analysis: The problem requires us to remove any n elements from the array such that the remaining elements are split into two parts of equal size. The goal is to minimize the difference between the sums of these two parts. The key insight is that the first part must consist of the smallest n elements from the left segment of th…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@basharul-siddike
Comment options

@mah-shamim
Comment options

mah-shamim Jul 18, 2025
Maintainer Author

Answer selected by basharul-siddike
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
question Further information is requested hard Difficulty
2 participants