上一页 1 ··· 25 26 27 28 29 30 31 32 33 ··· 40 下一页
摘要: 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 regu... 阅读全文
posted @ 2015-08-18 23:02 amazingzoe 阅读(169) 评论(0) 推荐(0)
摘要: Implement a trie withinsert,search, andstartsWithmethods.Note:You may assume that all inputs are consist of lowercase lettersa-z.Analyse: For each nod... 阅读全文
posted @ 2015-08-18 07:05 amazingzoe 阅读(260) 评论(0) 推荐(0)
摘要: 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 o... 阅读全文
posted @ 2015-08-18 03:50 amazingzoe 阅读(120) 评论(0) 推荐(0)
摘要: 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()... 阅读全文
posted @ 2015-08-18 03:11 amazingzoe 阅读(135) 评论(0) 推荐(0)
摘要: Given a collection of intervals, merge all overlapping intervals.For example,Given[1,3],[2,6],[8,10],[15,18],return[1,6],[8,10],[15,18].Analyse: First... 阅读全文
posted @ 2015-08-10 18:55 amazingzoe 阅读(128) 评论(0) 推荐(0)
摘要: Given an unsorted integer array, find the first missing positive integer.For example,Given[1,2,0]return3,and[3,4,-1,1]return2.Your algorithm should ru... 阅读全文
posted @ 2015-08-03 14:21 amazingzoe 阅读(181) 评论(0) 推荐(0)
摘要: Implement an iterator over a binary search tree (BST). Your iterator will be initialized with the root node of a BST.Callingnext()will return the next... 阅读全文
posted @ 2015-08-03 12:09 amazingzoe 阅读(108) 评论(0) 推荐(0)
摘要: Given acompletebinary tree, count the number of nodes.Definition of a complete binary tree fromWikipedia:In a complete binary tree every level, except... 阅读全文
posted @ 2015-08-03 11:12 amazingzoe 阅读(146) 评论(0) 推荐(0)
摘要: Given a binary search tree, write a functionkthSmallestto find thekth smallest element in it.Note:You may assume k is always valid, 1 ≤ k ≤ BST's tota... 阅读全文
posted @ 2015-08-03 10:07 amazingzoe 阅读(167) 评论(0) 推荐(0)
摘要: Given a binary search tree (BST), find the lowest common ancestor (LCA) of two given nodes in the BST.According to thedefinition of LCA on Wikipedia: ... 阅读全文
posted @ 2015-08-03 09:52 amazingzoe 阅读(143) 评论(0) 推荐(0)
上一页 1 ··· 25 26 27 28 29 30 31 32 33 ··· 40 下一页