Search
⌘K

Leetcode 2055. Plates Between Candles

Given a string of '*' (plates) and '|' (candles), answer many queries [l,r] by counting plates that lie strictly between at least one candle to their left and one to their right inside the substring (i.e., between the leftmost and rightmost candle in the range). The algorithmic challenge is to preprocess the string (e.g., nearest-candle indices and prefix sums) so each query can be answered efficiently.


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Comments

Your account is free and you can post anonymously if you choose.