Queue

题目

用来做缓存

  • Leetcode 157. Read N Characters Given Read4 (核心就是注意比较read的数量和剩余要读的n的数量的大小关系)
  • Leetcode 158. Read N Characters Given Read4 II - Call multiple times (Facebook店面)

sliding window(先进先出)

  • Leetcode 362. Design Hit Counter

LRU思想 (queue + HashMap)这样可以达到O(1)的查找以及增删

  • Leetcode 379. Design Phone Directory

results matching ""

    No results matching ""