given an array of objects that have an attribute count and an index n, how can objects after n be removed if their count is 0?
Please explain what is lacking in this question?
Well ... everything?
(Right now, which site did you post this question on, but that's not a deficit of your original question.)
Stack Exchange is full of smart people, but they don't have a crystal ball, nor can they read minds. You have to provide more details, otherwise we can't help you.