dsa1 min read
Evaluate Reverse Polish Notation — Operand Stack
Evaluate an RPN expression by pushing numbers and applying operators to the top two stack elements.
Read →
1575 articles
Evaluate an RPN expression by pushing numbers and applying operators to the top two stack elements.
Find the maximum in each sliding window of size k using a monotonic decreasing deque storing indices.
Simulate asteroid collisions using a stack where right-moving asteroids wait and left-moving ones destroy smaller ones.
Sum the minimums of all subarrays by computing each element's contribution as the minimum using previous and next smaller element spans.
Calculate the score of balanced parentheses where () = 1 and AB = A+B and (A) = 2*A using a stack depth trick.