Dsa
Two Pointers
Medium
Balanced Partition
Given an array of integers representing weights of items, determine if the array can be divided into two subsets such that the difference between the sums of the two subsets is minimized. Your goal is to return the minimum difference between the two partitions.
Input:
- The first line contains a single integer N (1 ≤ N ≤ 100), the number of items.
- The second line contains N space-separated integers denoting the weights of the items.
Output:
- Print the minimum difference between the two partitioned subsets.
Example:
Input:
4
1 6 11 5
Output:
1
Key concepts
two_pointersarray_partitioning
Practise this out loud — free
Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.
🎙 Practise this question now