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 · 74 阅读 · 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 · 140 阅读 · 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 · 82 阅读 · 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 · 67 阅读 · 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 · 97 阅读 · 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 · 175 阅读 · 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 · 71 阅读 · 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 · 91 阅读 · 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 · 73 阅读 · 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 · 159 阅读 · 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 true trie.search("app"); // return...原创 2019-04-17 11:57:43 · 62 阅读 · 0 评论