Company: ARCESIUM

Difficulty: hard

Problem Statement

# Equal-Size Minimum-Difference Partition You are given an integer array `A` of even length `N`. Partition all elements into two groups, each containing exactly `N/2` elements. Print the minimum possible absolute difference between the sums of the two groups. ## Input Format - The first line contains the even integer `N`. - The second line contains `N` space-separated integers `A[i]`. ## Output Format Print the minimum possible absolute difference. ## Constraints - `2 <= N <= 30` - `N` is even. - `-10000000 <= A[i] <= 10000000` - The answer fits in a signed 64-bit integer. ## Example 1 Input: 4 3 9 7 3 Output: 2 Explanation: The groups `{3, 9}` and `{7, 3}` have sums `12` and `10`. ## Example 2 Input: 2 -36 36 Output: 72 ## Example 3 Input: 6 2 -1 0 4 -2 -9 Output: 0 Explanation: The groups `{2, 4, -9}` and `{-1, 0, -2}` both have sum `-3`. ## Notes - Equal values at different indices are distinct elements and must all be assigned. - The groups are unordered; swapping them

More ARCESIUM OA questionsInterview experiences