# Category Archives: Data Structures

Given an integer N which corresponds to a N x N grid. The score you can get from a cell at the ith row and… Read More
Rotations in the array is defined as the process of rearranging the elements in an array by shifting each element to a new position. This… Read More
Matrix Rotation is defined as rotating the elements of the array around its center in a clockwise or counterclockwise direction, or rotating the elements by… Read More
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[][4] 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