随笔分类 - Stack & Queue
摘要:You have a browser of one tab where you start on the homepage and you can visit another url, get back in the history number of steps or move forward i
阅读全文
摘要:Design a stack which supports the following operations. Implement the CustomStack class: CustomStack(int maxSize) Initializes the object with maxSize
阅读全文
摘要:Problem description: Design a class to find the kth largest element in a stream. Note that it is the kth largest element in the sorted order, not the
阅读全文
摘要:Design your implementation of the circular double-ended queue (deque). Your implementation should support following operations: MyCircularDeque(k): Co
阅读全文
摘要:Design your implementation of the circular queue. The circular queue is a linear data structure in which the operations are performed based on FIFO (F
阅读全文
摘要:Infix : An expression is called the Infix expression if the operator appears in between the operands in the expression. Simply of the form (operand1 o
阅读全文
摘要:Infix expression: The expression of the form a op b. When an operator is in-between every pair of operands.Postfix expression: The expression of the f
阅读全文
摘要:Infix : An expression is called the Infix expression if the operator appears in between the operands in the expression. Simply of the form (operand1 o
阅读全文
摘要:Postfix to Prefix Conversion Postfix: An expression is called the postfix expression if the operator appears in the expression after the operands. Sim
阅读全文
摘要:Given a list of daily temperatures T, return a list such that, for each day in the input, tells you how many days you would have to wait until a warme
阅读全文
摘要:Design a hit counter which counts the number of hits received in the past 5 minutes. Each function accepts a timestamp parameter (in seconds granularity) and you may assume that calls are being made ...
阅读全文
摘要:Example : Infix : (A+B) * (C-D) ) Postfix: AB+CD-* 算法: 1. Scan the infix expression from left to right. 2. If the scanned character is an operand, app
阅读全文
摘要:Implement FreqStack, a class which simulates the operation of a stack-like data structure. FreqStack has two functions: push(int x), which pushes an i
阅读全文
摘要:Given a string representing arbitrarily nested ternary expressions, calculate the result of the expression. You can always assume that the given expre
阅读全文
摘要:Given a stream of integers and a window size, calculate the moving average of all integers in the sliding window. For example,MovingAverage m = new Mo
阅读全文
摘要:Implement Queue by Two Stacks Implement Queue by Two Stacks Implement Queue by Two Stacks Implement the following operations of a queue using stacks.
阅读全文
摘要:Evaluate the value of an arithmetic expression in Reverse Polish Notation. Valid operators are +, -, *, /. Each operand may be an integer or another e
阅读全文
摘要:Valid Parentheses Given a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid. Example The b
阅读全文
摘要:Implement a stack with min() function, which will return the smallest number in the stack. It should support push, pop and min operation all in O(1) c
阅读全文

浙公网安备 33010602011771号