Is there any faster method besides using queue to solve this quiz ?

  • 1

    i established a queue to solve this quiz using links, and already passed. The idea is straightforward, but not as beautiful as i imagined. I guess there must be more efficient and beautiful methods beyond using queues.

  • 1

    Actually, the LRU is a practical algorithm used in Kernel. So using queue for LRU is too slow. When asked something about efficiency, the first thing you should come up with is using HashTable. So think about it and try!

Log in to reply

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.