Skip to content

Tag Archives: priority-queue

Given a string S consisting of digits from 0 to 9 inclusive, the task is to form the lexicographically smallest string by performing an operation… Read More
A Priority Queue is a data structure that allows you to insert elements with a priority, and retrieve the element with the highest priority.  You… Read More
Design a simplified version of Twitter where users can post tweets, follow/unfollow another user, and see the 10 most recent tweets in their news feed. … Read More
A PriorityQueue is an abstract data type that is similar to a queue, and every element has some priority value associated with it.  It is… Read More
The Task is to extract the last element of the priority queue without traversing it. Approach: This problem can be solved using a Double-ended priority… Read More
What is Queue? Queue is an abstract data type that is open at both ends. One end is always used to insert data (enqueue) which… Read More
Given a binary string S and an array arr[] each of size N, we can pick any element from the Array which is to the… Read More
Given two arrays A[] and B[] of length N, the task is to check if both arrays can be made equal by performing the following… Read More
What is Dijkstra’s Algorithm? Dijkstra’s Algorithm is used for finding the shortest path between any two vertices of a graph. It uses a priority queue… Read More
Given a number X, and an array arr[] of length N containing the N numbers. The task is to find the minimum number of operations… Read More
Given a rod of length L and an array arr[] of length N, the task is to find if it is possible to break the… Read More
Given an Array input[] consisting only of 1s initially and an array target[] of size N, the task is to check if the array input[]… Read More
Given an array arr[] of N integers, the task is to replace each element of Array with their rank according to Rightmost-Set Bit (RSB) in… Read More
Given an array arr[] of size N, the task is to find the number of operations to convert array elements to zero by decrementing the… Read More
Given an array arr[] and an integer N, the task is to find the maximum number of pairs that can be formed such that ith… Read More

Start Your Coding Journey Now!