# Category Archives: Data Structures

A minimum spanning tree (MST) is defined as a spanning tree that has the minimum weight among all the possible spanning trees A spanning tree… Read More
Given N sticks with two sides Left and Right (represented by 0 and 1). Given 2d array, A[] of size M representing operations that have… Read More
Why does the queue have front but the priority queue has top in stl? The main difference between a queue and a priority queue is… Read More
Given a string S of length N(N > 3), the task is to count distinct strings that can be made by removing three consecutive characters… Read More
Given a linked list of integers and a number K, find the maximum sum of a subarray of length K.  Examples: Input: List = 1… Read More
A matrix is a two-dimensional array that consists of rows and columns. It is an arrangement of elements in horizontal or vertical lines of entries.… Read More
Given an array arr[] of integers and an integer K, the task is to find the minimum number of operations required to make every Kth… Read More
Given an array arr[] of N integers, the task is to find the length of the longest subarray where the sum of the elements in… Read More
Given an array arr[] of positive integers, the task is to find the count of all triplets such that XOR of two equals the third… Read More
Dynamic Segment Trees with Poly Hash Tables is a data structure that combines the benefits of both dynamic segment trees and hash tables to efficiently… Read More
Given an array arr[] consisting of N ranges of the form [L, R], the task is to select K ranges such that the intersection length… Read More
Given an integer N and four values a, b, c, d (where a ≥ 0, b ≥ 0, c ≥ 0, d ≥ 0), the… Read More
Given a 0-based n x n integer matrix where grid[x][y] represents the height of the blocks in row x and column y. You can increase… Read More
Given the head of a linked list, the task is to replace all the values of the nodes with the nearest prime number. If more… Read More
Given a Binary tree with an integer X, where X represents the node’s value in an integer. Find the distance between the given node and… Read More