The algorithm has three phases per round:
1. Mark:: Find all horizontal and vertical runs of 3+ same candies. Mark them for removal.
2. Crush:: Remove all marked candies (set to 0 or empty).
3. Drop:: Apply gravity. Each column's candies fall to fill empty spaces. Repeat until no candies are marked. The greedy aspect: crush everything possible before dropping. Common bug: crushing one match at a time instead of all at once can miss cascading matches. Time: O(n). Space: O(n).