Dsa
Arrays
Medium
Balanced Array Check
You are given an array of integers. Determine if the array can be partitioned into two subarrays with equal sums.
Input Format:
- The first line contains a single integer n (1 <= n <= 1000), the size of the array.
- The second line contains n integers, separated by spaces, representing the elements of the array.
Output Format:
- Print "YES" if the array can be split into two subarrays with equal sums, otherwise print "NO".
Example:
Input:
4
1 2 3 5
Output:
YES
Key concepts
arraysprefix_sumparity
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