随笔分类 -  datastructure

摘要:You are given several logs that each log contains a unique id and timestamp. Timestamp is a string that has the following format: Year:Month:Day:Hour: 阅读全文
posted @ 2018-01-08 12:32 逸朵 阅读(200) 评论(0) 推荐(0)
摘要:Design and implement a data structure for a compressed string iterator. It should support the following operations: next and hasNext. The given compre 阅读全文
posted @ 2018-01-05 06:19 逸朵 阅读(142) 评论(0) 推荐(0)
摘要:TinyURL is a URL shortening service where you enter a URL such as https://leetcode.com/problems/design-tinyurl and it returns a short URL such as http 阅读全文
posted @ 2018-01-02 05:35 逸朵 阅读(257) 评论(0) 推荐(0)
摘要:Design a data structure that supports all following operations in average O(1) time. Note: Duplicate elements are allowed. insert(val): Inserts an ite 阅读全文
posted @ 2018-01-02 03:49 逸朵 阅读(145) 评论(0) 推荐(0)
摘要:1 Implement a Key-Value pair datastucture such that there is: 2 O(1) insertion void insert(K, V) 3 O(1) fetching 4 O(1) deletion ... 阅读全文
posted @ 2017-12-13 08:26 逸朵 阅读(146) 评论(0) 推荐(0)
摘要:Implement a trie with insert, search, and startsWith methods. Note:You may assume that all inputs are consist of lowercase letters a-z. 阅读全文
posted @ 2017-11-29 09:42 逸朵 阅读(136) 评论(0) 推荐(0)
摘要:Design a stack that supports push, pop, top, and retrieving the minimum element in constant time. push(x) -- Push element x onto stack. pop() -- Remov 阅读全文
posted @ 2017-11-23 05:26 逸朵 阅读(106) 评论(0) 推荐(0)
摘要:Design and implement a data structure for Least Recently Used (LRU) cache. It should support the following operations: get and put. get(key) - Get the 阅读全文
posted @ 2017-11-23 02:49 逸朵 阅读(132) 评论(0) 推荐(0)