It seems that that solution is incorrect. Each time when we insert a new element and eviction is needed, we should compare the frequency to the min frequency instead of just delete the min frequency element.
Course: https://www.educative.io/courses/decode-coding-interview-cpp
Lesson: Feature #6: Fetch Most Frequently Watched Titles - Decode the Coding Interview in C++: Real-World Examples