Five minutes. One pattern. Stay fluent.
Daily etudes
Slug squash
Given a string s containing lowercase Latin letters, repeatedly remove pairs of equal adjacent letters until no such pair remains. Each removal deletes exactly two letters; the newly adjacent letters can form another pair. Return the remaining string, which may be empty.
Example:
squash_slug("wooll") → "w"
In wooll, oo goes away → wll, then ll goes away → w.
squash_slug("xzzx") → ""
In xzzx, zz then xx leave nothing.
Pattern: stack - if the top equals the next letter, pop; otherwise push