# Category Archives: Data Structures

This category is for logical grouping only. It needn’t to be added directly. Instead, the sub-categories should be added.

## Count of ways to select K consecutive empty cells from a given Matrix

Given a binary matrix V[][] of dimensions N * M, wherein each cell is either empty or blocked marked by a 0 and 1 respectively,… Read More »

## Flattening a linked list | Set 2

Given a linked list where every node represents a linked list and contains two pointers of its type: Pointer to next node in the main… Read More »

## Check if a string can be split into substrings starting with N followed by N characters

Given a string str, the task is to check if it can be split into substrings such that each substring starts with a numeric value… Read More »

## Count quadruplets(A, B, C, D) till N such that sum of square of A and B is equal to that of C and D

Given a number N, the task is to find the number of quadraples such that a2 + b2 = c2 + d2 where (1 <=… Read More »

## Maximum bitwise OR value of subsequence of length K

Given an array arr[] of N positive integers and a number K, the task is to find the maximum value of bitwise OR of the… Read More »

## Replace every vowels with lexicographically next vowel in a String

Given a string str of size N, which contains lowercase English alphabets. The task is to replace each vowel with the next immediate vowel lexicographically,… Read More »

## Check if a graph is Strongly, Unilaterally or Weakly connected

Given an unweighted directed graph G as a path matrix, the task is to find out if the graph is Strongly Connected or Unilaterally Connected… Read More »

## Maximum cost path in an Undirected Graph such that no edge is visited twice in a row

Given an undirected graph having N vertices and M edges and each vertex is associated with a cost and a source vertex S is given.… Read More »

## Reverse a subarray of the given array to minimize the sum of elements at even position

Given an array arr[] of positive integers. The task is to reverse a subarray to minimize the sum of elements at even places and print… Read More »

## Print the longest path from root to leaf in a Binary tree

Given a binary tree, the task is to print the longest path from the root node to the leaf node. If there are multiple answers… Read More »

## Represent K as sum of N-bonacci numbers

Given two numbers K and N. The task is to represent the given number K as a sum of several N-bonacci numbers. Examples: Input: K… Read More »

## Minimize sum of smallest elements from K subsequences of length L

Given an array arr[] of size N, the task is to find the minimum possible sum by extracting the smallest element from any K subsequences… Read More »

## Minimum cost of reducing Array by merging any adjacent elements repetitively

Given an array arr[] of N numbers. We can merge two adjacent numbers into one and the cost of merging the two numbers is equal… Read More »

## Smallest number to be added in first Array modulo M to make frequencies of both Arrays equal

Given two arrays A[] and B[] consisting of N positive integers and a integer M, the task is to find the minimum value of X… Read More »

## Generate Array whose difference of each element with its left yields the given Array

Given an integer N and an arr1[], of (N – 1) integers, the task is to find the sequence arr2[] of N integers in the… Read More »