educative.io

DIY: LFU Cache - Decode the Coding Interview in C++: Real-World Examples

LFUSet(10, 20) (10,20) (10,20) Incorrect Output
LFUSet(15, 25) (10,20)(15,25) (15,25)(10,20) Incorrect Output
LFUSet(20, 30) (15,25)(20,30) (20,30)(15,25) Incorrect Output
LFUSet(25, 35) (20,30)(25,35) (25,35)(20,30) Incorrect Output

The output and expected output are correct in terms of value but the ordering is wrong, Since the printing is done on map, i am unsure how do i make sure that map always insert after the element and dont reorder it/