[LeetCode] #priorityQueue #heap #O(1) Maximum Frequency Stack
leetcode.com/explore/challenge/card/february-leetcoding-challenge-2021/587/week-4-february-22nd-february-28th/3655/ 스택과 유사한 자료 구조인 FreqStack을 구현하십시오. FreqStack은 두 가지 기능을 가지고 있습니다. push(int x), 스택에 정수 x를 집어넣습니다. pop(), 스택에서 가장 빈번하게 나타나는 요소를 제거한 뒤 반환합니다. 가장 빈번하게 나타나는 요소가 두 개 이상인 경우 스택의 맨 위에서 가장 가까운 요소를 제거하고 반환합니다. Example 1: Input: ["FreqStack","push","push","push","push","push","push","pop","pop"..
더보기