dsa2 min read
Maximum Frequency Stack
Design a stack that pops the most frequent element, breaking ties by most recently pushed, using frequency-bucket stacks.
Read →
webcoderspeed.com
1276 articles
Design a stack that pops the most frequent element, breaking ties by most recently pushed, using frequency-bucket stacks.
Minimize max-min of an array by doubling odd numbers and repeatedly halving the max using a max-heap.
Extended practice: compute median for each window in a stream using two-heap with lazy deletion pattern.
For each query point, find the smallest interval containing it by sorting both intervals and queries, using a min-heap.
For each interval find the interval with the smallest start point >= the end point using sorted starts and binary search.