ProDeveloperTutorialonJanuary 19, 2025 Heaps: Sort an Array using heap Problem Statement: Given an array, sort it by using heap sort. Solution Relationship between array and heap elements. As we know that heaps…
ProDeveloperTutorialonJanuary 19, 2025 Heaps: Build Min Heap from an Array Problem Statement: You are given N array elements. You need to build a Min Heap. Solution Min Heap: The root element is greater than its…
ProDeveloperTutorialonJanuary 19, 2025 Next Smaller Element Problem Statement: YOu are given an unsorted array, you need to find the next smaller element for all the elements. Next smaller element for…
ProDeveloperTutorialonJanuary 19, 2025 Reverse the first “K” elements of a queue Problem Statement: You are given a queue and an element k, you need to reverse the first ‘k’ elements in the queue. Example Input:…
ProDeveloperTutorialonJanuary 19, 2025 Queue Reversal Problem Statement: Given a queue, you need to reverse it. Solution This problem can be solved in 2 different methods. Method 1: Using stack.…
ProDeveloperTutorialonJanuary 19, 2025 Stack: Check if a stack is a permutation of another stack Problem Statement: You are given 2 array, check one array is permutation of another array. Example Input : First array: 1, 2, 3 Second array:…
ProDeveloperTutorialonJanuary 19, 2025 Implement Stack using Queues Problem Statement: You need to create stack data structure using only queue data structure. Solution As we know that for stack insertion and…
ProDeveloperTutorialonJanuary 19, 2025 Stack: Expression contains redundant bracket or not Problem Statement: You are given an expression in the form of a string. You need to check if the string has redundant brackets. Example Input:…
ProDeveloperTutorialonJanuary 19, 2025 Stack: Length of the longest valid substring Problem Statement: You are given a string, you need to find the length of longest valid parenthesis. Example Input : ((() Output : 2 Solution…
ProDeveloperTutorialonJanuary 19, 2025 Largest Rectangular Area in a Histogram Problem Statement: You are given an array that represents a bar in a histogram. You need to find out the largest rectangle that can be made…