prefixSum to store the cumulative count of plates up to each index.candles to store the indices of candles.s and update prefixSum and candles accordingly.[left, right], perform binary search on candles to find the closest candle index to the right of left and the closest candle index to the left of right.prefixSum array.result and return it.