
Design
weixin_39145266
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
295 Find Median from Data Stream
1 题目Median is the middle value in an ordered integer list. If the size of the list is even, there is no middle value. So the median is the mean of the two middle value.For example,[2,3,4], the m...原创 2019-12-05 12:12:19 · 113 阅读 · 0 评论 -
348 Design Tic-Tac-Toe
1 题目Design a Tic-tac-toe game that is played between two players on anxngrid.You may assume the following rules:A move is guaranteed to be valid and is placed on an empty block. Once a winn...原创 2019-12-05 10:55:19 · 178 阅读 · 0 评论 -
146 LRU Cache
1 题目Design and implement a data structure forLeast Recently Used (LRU) cache. It should support the following operations:getandput.get(key)- Get the value (will always be positive) of the key...原创 2019-12-03 09:45:09 · 111 阅读 · 0 评论 -
380 Insert Delete GetRandom O(1)
1 题目Design a data structure that supports all following operations inaverageO(1)time.insert(val): Inserts an item val to the set if not already present. remove(val): Removes an item val fro...原创 2019-07-13 20:33:16 · 85 阅读 · 0 评论 -
341 Flatten Nested List Iterator
Given a nested list of integers, implement an iterator to flatten it.Each element is either an integer, or a list -- whose elements may also be integers or other lists.Example 1:Input: [[1,1],2...原创 2019-07-07 18:05:08 · 120 阅读 · 0 评论 -
155 Min Stack
1 题目Design a stack that supports push, pop, top, and retrieving the minimum element in constant time.push(x) -- Push element x onto stack. pop() -- Removes the element on top of the stack. top()...原创 2019-05-07 15:25:23 · 200 阅读 · 0 评论 -
232 Implement Queue using Stacks
1 题目Implement the following operations of a queue using stacks.push(x) -- Push element x to the back of queue. pop() -- Removes the element from in front of queue. peek() -- Get the front elemen...原创 2019-05-06 17:46:21 · 94 阅读 · 0 评论 -
225 Implement Stack using Queues
1 题目Implement the following operations of a stack using queues.push(x) -- Push element x onto stack. pop() -- Removes the element on top of the stack. top() -- Get the top element. empty() -- R...原创 2019-05-06 15:42:51 · 116 阅读 · 0 评论 -
211 Add and Search Word - Data structure design
1 题目Design a data structure that supports the following two operations:void addWord(word)bool search(word)search(word) can search a literal word or a regular expression string containing only l...原创 2019-04-24 14:20:38 · 87 阅读 · 0 评论 -
284 Peeking Iterator
1 题目Given an Iterator class interface with methods: next() and hasNext(), design and implement a PeekingIterator that support the peek() operation -- it essentially peek() at the element that will ...原创 2019-04-24 14:16:31 · 186 阅读 · 0 评论 -
208 Implement Trie (Prefix Tree)
1 题目Implement a trie with insert, search, and startsWith methods.Example:Trie trie = new Trie();trie.insert("apple");trie.search("apple"); // returns truetrie.search("app"); // return...原创 2019-04-17 11:57:43 · 80 阅读 · 0 评论