Search
⌘K

Leetcode 895. Maximum Frequency Stack

Design a stack-like data structure supporting push(val) and pop() where pop removes the most frequent element (breaking ties by recency, i.e., the one closest to the top). The core challenge is efficiently tracking element frequencies and their ordering so many operations (up to ~2×10^4) can be handled quickly.

Asked at:

Glovo


Question Timeline

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

Late July, 2025

Glovo

Mid-level

Comments

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