随笔分类 - 算法题
摘要:Description:Given an array of integers, find out whether there are two distinct indicesiandjin the array such that the difference betweennums[i]andnum...
阅读全文
摘要:Description:Serialization is the process of converting a data structure or object into a sequence of bits so that it can be stored in a file or memory...
阅读全文
摘要: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...
阅读全文
摘要:Description:Design and implement a data structure for Least Recently Used (LRU) cache. It should support the following operations:getandset.get(key)- ...
阅读全文
摘要:There areNgas stations along a circular route, where the amount of gas at stationiisgas[i].You have a car with an unlimited gas tank and it costscost[...
阅读全文
摘要:Description:Given an array of non-negative integers, you are initially positioned at the first index of the array.Each element in the array represents...
阅读全文
摘要:Description:Given an array of non-negative integers, you are initially positioned at the first index of the array.Each element in the array represents...
阅读全文
摘要:Description:Implement a trie withinsert,search, andstartsWithmethods.Note:You may assume that all inputs are consist of lowercase lettersa-z.实现一个简单的Tr...
阅读全文
摘要:Description:You are playing the following Nim Game with your friend: There is a heap of stones on the table, each time one of you take turns to remove...
阅读全文
摘要:Description:Design a data structure that supports the following two operations:void addWord(word)bool search(word)search(word) can search a literal wo...
阅读全文
摘要:Description:Given an Iterator class interface with methods:next()andhasNext(), design and implement a PeekingIterator that support thepeek()operation ...
阅读全文
摘要:Description:Givennpairs of parentheses, write a function to generate all combinations of well-formed parentheses.For example, givenn= 3, a solution se...
阅读全文
摘要:Description:Say you have an array for which theithelement is the price of a given stock on dayi.Design an algorithm to find the maximum profit. You ma...
阅读全文
摘要:Description:Say you have an array for which theithelement is the price of a given stock on dayi.Design an algorithm to find the maximum profit. You ma...
阅读全文
摘要:Description:Say you have an array for which theithelement is the price of a given stock on dayi.If you were only permitted to complete at most one tra...
阅读全文
摘要:Description:Suppose a sorted array is rotated at some pivot unknown to you beforehand.(i.e.,0 1 2 4 5 6 7might become4 5 6 7 0 1 2).Find the minimum e...
阅读全文
摘要:Description:Given an array where elements are sorted in ascending order, convert it to a height balanced BST.给一个升序有序的数组,构建一个平衡的二叉查找树。要平衡就要找中间的数来做头结点,递...
阅读全文
摘要:Description:Given an array containingndistinct numbers taken from0, 1, 2, ..., n, find the one that is missing from the array.For example,Givennums=[0...
阅读全文
摘要:Description:Given an integer, convert it to a roman numeral.Input is guaranteed to be within the range from 1 to 3999.noting to say.public class Solut...
阅读全文
摘要:Description:Given a string of numbers and operators, return all possible results from computing all the different possible ways to group numbers and o...
阅读全文
浙公网安备 33010602011771号