Evaluating Reverse Polish Notation, Sliding Window Maximum, and Top K Frequent Elements
Evaluating Reverse Polish Notation
Problem:
Given an array of strings tokens representing an arithmetic expression in Reverse Polish Notation, evaluate the expression and return the resulting integer value.
Constraints:
Valid operators are '+', '-', '*', and '/'.
Each operand can be an integer or another expression.
Division between two intege ...
Posted on Tue, 20 Oct 2026 16:30:31 +0000 by ozzmans
The Multiple Knapsack Problem
The Multiple Knapsack Problem
Given n types of items, where type i has c_i copies, value v_i, and weight w_i. We need to select items to maximize the total value in a knapsack with maximum capacity m.
Solution 1
One approach is to transform the multiple knapsack problem into a 0-1 knapsack problem. The naive method would be to split each item t ...
Posted on Thu, 17 Sep 2026 16:40:37 +0000 by jeffz2008
Maximum Values in Sliding Windows via Monotonic Deques
Given an integer array nums and an integer k, a sliding window of size k traverses the array from left to right. Only the k numbers within the window are visible at any step, and the window shifts right by one position after each move. The task is to return the maximum element inside the window for every valid posiiton.
Example 1
Input: nums = ...
Posted on Mon, 14 Sep 2026 16:45:15 +0000 by itarun