# 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.

## Minimum flips required in a binary string such that all K-size substring contains 1

Given a binary string str of size N and a positive integer K, the task is to find the minimum number of flips required to… Read More »

## Find k most frequent in linear time

Given an array of integers, we need to print k most frequent elements. If there is a tie, we need to prefer the elements whose… Read More »

## Largest possible square submatrix with maximum AND value

Given an integer matrix mat [ ][ ] dimensions, the task is to find the largest possible square matrix from the given matrix with maximum… Read More »

## Minimize steps required to move all 1’s in a matrix to a given index

Given a binary matrix mat[][] of size NxM and two integers X and Y, the task is to find the minimum number steps required to… Read More »

## Count of lists which are not a subset of any other given lists

Given N lists of strings, the task is to find the count of lists which are not a sublist of any other given lists. Examples:… Read More »

## Total number of unit cells covered by all given Rectangles

Given a matrix A[][] consisting of coordinates of N rectangles such that {A[i], A[i]} representing bottom left coordinate of rectangle and {A[i], A[i]} representing top… Read More »

## Smallest number containing all possible N length permutations using digits 0 to D

Given two integer N and K, the task is to find the size of the smallest string that contains all permutations of length N that can… Read More »

## Print all shortest paths between given source and destination in an undirected graph

Given an undirected and unweighted graph and two nodes as source and destination, the task is to print all the paths of the shortest length… Read More »

## Count of subsequences of length 4 in form (x, x, x+1, x+1) | Set 2

Given a large number in form of string str of size N, the task is to count the subsequence of length 4 whose digit are… Read More »

## Count number of ways to convert string S to T by performing K cyclic shifts

Given two strings S and T and a number K, the task is to count the number of ways to convert string S to string… Read More »

## Frequency of maximum occurring subsequence in given string

Given a string str of lowercase English alphabets, our task is to find the frequency of occurrence a subsequence of the string which occurs the… Read More »

## Find the missing number in unordered Arithmetic Progression

Given an unsorted array arr[] of N integers that are in Arithmetic Progression, the task is to print the missing element from the given series.… Read More »

## Total number of components in the index Array

Given an array arr[] of N integers of value from 0 to N, the task is to count the number of components in Index Array.… Read More »

## Largest substring where all characters appear at least K times | Set 2

Given a string str and an integer K, the task is to find the length of the longest sub-string S such that every character in… Read More »

## Construct the Array using given bitwise AND, OR and XOR

Given Bitwise AND, OR, and XOR of N elements of an array denoted by a, b, c. The task is to find the elements of… Read More »