dsa1 min read
Remove All Adjacent Duplicates in String II — Stack with Counts
Remove k adjacent identical characters repeatedly using a stack that tracks (character, count) pairs.
Read →
1575 articles
Remove k adjacent identical characters repeatedly using a stack that tracks (character, count) pairs.
Design a hit counter that returns hits in the past 5 minutes using a queue to expire old timestamps.
Find the largest rectangle in a histogram by computing left and right boundaries using a monotonic increasing stack.
Find the maximal rectangle in a binary matrix by building histogram heights row by row and applying largest rectangle.
Evaluate a basic expression with +, -, and parentheses using a stack to save and restore sign context.