← All problemsSign in

3776. Minimum Moves to Balance Circular Array

LeetCodeArrayGreedySortingOpen on judge ↗

You are given a circular array balance of length n, where balance[i] is the net balance of person i. In one move, a person can transfer exactly 1 unit of balance to either their left or right neighbor. Return the minimum number of moves required so that every person has a non-negative balance. If it is impossible, return -1. Note: You are guaranteed that at most 1 index has a negative balance i

HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17

CodeSearch Tutor

Hints, not spoilers — it won’t hand over the full solution unless you insist.

voice by Sarvam AI

Sign in to chat with the tutor and save your progress.

Sign in to start