dsa1 min read
Flatten Nested List Iterator — Stack-Based Lazy Expansion
Implement an iterator for a nested list using a stack that lazily expands nested lists as elements are consumed.
Read →
webcoderspeed.com
1276 articles
Implement an iterator for a nested list using a stack that lazily expands nested lists as elements are consumed.
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.