Trains the technique from
LeetCode 1189Maximum Number of BalloonsThis is an original problem, written from a brief that listed the technique, the difficulty, the topics, the function shape and the input bounds — none of that problem's wording, examples, hints or editorials. The link is there so you can map your practice onto the standard set.
Same function shape, different story and different numbers.
A sign shop keeps loose letter tiles in one tray. The string tiles gives the letter printed on each tile in the tray, one lowercase letter per tile.
A finished sign spells the word kettle, so laying out one sign takes a k tile, two e tiles, two t tiles and an l tile. A tile can only be laid into one sign: once it is used it is gone for the rest of the run, and tiles printed with any other letter are no help at all.
Return how many finished signs the shop can lay out from the tray it has.
Example 1
The tray holds two k tiles, four e tiles, four t tiles and four l tiles. Two signs use two k, four e, four t and two l tiles, which the tray covers, and two l tiles are left over.
Example 2
One sign takes a k, two e, two t and an l tile. That leaves a k, two e, a t and two l tiles sitting unused in the tray.
Example 3
There is no k tile anywhere in the tray, so no sign can be laid out.
The editor is preloaded with this. It matches the parent problem's shape, so a solution that works here transfers to a judge unchanged.
def kettle_signs(tiles: str) -> int:public int kettleSigns(String tiles)See the step-by-step animation, the intuition, and clean code in every language — free, no credit card.