Question:-
My answere:
for (int i = 0; i < n;) { if (a[i] == 0) { break; } else { a[i] -= 1; cnt += 1; } if (i % n == 1) { i = 0; } else { i++; } }