Search
⌘K

Leetcode 1381. Design a Stack With Increment Operation

Implement a bounded stack (maxSize) supporting push, pop (returning -1 if empty), and increment(k, val) which adds val to the bottom k elements; the core challenge is applying these bottom-k increments efficiently (avoiding O(k) per increment) using lazy/differential bookkeeping so operations are O(1).

Asked at:

Google

Google


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Mid May, 2025

Google

Google

Mid-level

Leetcode 1381. Design a Stack With Increment Operation

Your account is free and you can post anonymously if you choose.