# Category Archives: Queue

## Find the last remaining Character in the Binary String according to the given conditions

Given a binary string str consisting of only 0’s and 1’s. The following two operations can be performed on it: One digit can delete another… Read More »

## Length of Smallest Subsequence such that sum of elements is greater than equal to K

Given an array arr[] of size N and a number K, the task is to find the length of the smallest subsequence such that the… Read More »

## Arrange the array such that upon performing given operations an increasing order is obtained

Given an array arr[] of size N, the task is to print the arrangement of the array such that upon performing following operations on this… Read More »

## Level order traversal in spiral form | Using Deque

Given a Binary Tree, the task is to print spiral order traversal of the given tree. For below tree, the function should print 1, 2,… Read More »

## Minimum cost to reach from the top-left to the bottom-right corner of a matrix

Given an N * M matrix mat[][] consisting of lower case characters, the task is to find the minimum cost to reach from the cell… Read More »

## Minimum cost to traverse from one index to another in the String

Given a string S of length N consisting of lower case character, the task is to find the minimum cost to reach from index i… Read More »

## Find the count of unvisited indices in an infinite array

Given an array of infinite length and two integers M and N which are co-primes, the task is to find the number of positions that… Read More »

## Find parent of each node in a tree for multiple queries

Given a tree with N vertices numbered from 0 to N – 1 and Q query containing nodes in the tree, the task is to… Read More »

## Word Ladder – Set 2 ( Bi-directional BFS )

Given a dictionary, and two words start and target (both of the same length). Find length of the smallest chain from start to target if… Read More »

## Queries to find the left-most given type integer in a binary array

Given a binary array arr[], the task is to design a data structure that supports the following operations in O(1). Type 1: Remove and print… Read More »

## Queue in Python

Like stack, queue is a linear data structure that stores items in First In First Out (FIFO) manner. With a queue the least recently added… Read More »

## Count of numbers in the range [L, R] which satisfy the given conditions

Given a range [L, R], the task is to find the count of numbers from this range that satisfy the below conditions: All the digit… Read More »

## Find the number on the card that remains in the end after performing the given operations

Given an integer N which represents the number of cards in a deck. The deck is ordered from 1 to N where 1 is the… Read More »

## Print odd positioned nodes of even levels in level order of the given binary tree

Given a binary tree, the task is to print the odd positioned nodes of even levels in the level order traversal of the tree. The… Read More »

## Print even positioned nodes of odd levels in level order of the given binary tree

Given a binary tree, the task is to print the even positioned nodes of odd levels in the level order traversal of the tree. The… Read More »