← All problemsSign in

2086. Minimum Number of Food Buckets to Feed the Hamsters

LeetCodeStringDynamic ProgrammingGreedyOpen on judge ↗

You are given a 0-indexed string hamsters where hamsters[i] is either: - 'H' indicating that there is a hamster at index i, or - '.' indicating that index i is empty. You will add some number of food buckets at the empty indices in order to feed the hamsters. A hamster can be fed if there is at least one food bucket to its left or to its right. More formally, a hamster at index i can be fed if

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