Dsa
Arrays
Medium
Array Rotation Balance
Given an array of integers, determine if the array can be balanced by rotating it. An array is balanced if it can be divided into two segments with equal sums after a certain rotation.
Input:
- The first line contains an integer n (1 <= n <= 100) — the size of the array.
- The second line contains n space-separated integers, the elements of the array.
Output:
- Print 'YES' if the array can be balanced by rotation, otherwise print 'NO'.
Example:
Input:
4
1 2 3 4
Output:
YES
Key concepts
arraysrotation
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