Skip to content

Category Archives: Stack

Given 2 input stacks with elements in an unsorted manner. Problem is to merge them into a new final stack, such that the elements become… Read More
Given a bracket sequence or in other words a string S of length n, consisting of characters ‘(‘ and ‘)’. Find the length of the… Read More
Given an array a[1..N]. For each element at position i (1 <= i <= N). Where   L(i) is defined as closest index j such that… Read More
Given a Queue consisting of first n natural numbers (in random order). The task is to check whether the given Queue elements can be arranged… Read More
Given an array of elements, task is to sort these elements using stack. Prerequisites : Stacks Examples : Input : 8 5 7 1 9… Read More
Given a binary tree, print the level order traversal in such a way that first two levels are printed from left to right, next two… Read More
Given a string that contains only the following => ‘{‘, ‘}’, ‘(‘, ‘)’, ‘[’, ‘]’. At some places there is ‘X’ in place of any… Read More
Given a bracket sequence or in other words a string S of length n, consisting of characters ‘(‘ and ‘)’. Find length of the maximum… Read More
Given a stack with push(), pop(), empty() operations, delete middle of it without using any additional data structure. Input : Stack[] = [1, 2, 3,… Read More
Given an expression exp of length n consisting of some brackets. The task is to print the bracket numbers when the expression is being parsed.… Read More
Telephonic Round-1 A number of bad URLs are given (number could be huge-millions of them). Now user enters a URL, you need to identify whether… Read More
Infix : An expression is called the Infix expression if the operator appears in between the operands in the expression. Simply of the form (operand1… Read More
Prefix: An expression is called the prefix expression if the operator appears in the expression before the operands. Simply of the form (operator operand1 operand2). Example… Read More
Postfix: An expression is called the postfix expression if the operator appears in the expression after the operands. Simply of the form (operand1 operand2 operator). Example… Read More