Given an array arr[] consisting of N integers and an integer K, the task is to count the number of subsequences of the given array… Read More

# Category Archives: Data Structures

Given an array arr[] consisting of first N natural numbers, construct a undirected graph using the array elements such that for any array element, connect… Read More

Given an array arr[] consisting of positive integers and an array Q[][] consisting of queries, the task for every ith query is to count array… Read More

Given two arrays arr1[] and arr2[] of equal length, the task is to find the maximum sum of any subset possible by selecting elements from… Read More

Given an array arr[] of size N, the task is to find the number of prefix arrays whose maximum is less than the maximum element… Read More

Given an array arr[] of size N and a positive integer K, the task is to find the index of the smallest array element required… Read More

Given an array arr[] of N non-negative integers and an integer K, the idea is to find the length of the longest subsequence having Xor… Read More

Given an array arr[] of length N, the task is to select a quadruple (i, j, k, l) and calculate the sum of the second… Read More

Given a matrix arr[][] of size N * M, the task is to print the boundary elements of the given matrix in a clockwise form.… Read More

STL Priority Queue is the implementation of Heap Data Structure. By default, it’s a max heap, and can be easily for primitive data types. There… Read More

Given a string S of size N and a positive integer K, the task is to perform atmost K operations on string S to make… Read More

Maximize difference between the sum of absolute differences of each element with the remaining array

Given an array arr[] consisting of N integers, the task is to maximize the difference between the sum of absolute difference of an element with… Read More

Given two strings S1 and S2, the task is to check if string S1 can be made equal to string S2 by swapping any pair… Read More

Given a string S, the task is to design a Deterministic Finite Automata (DFA) for accepting the language L = C (A + B)+. If… Read More

Given a Binary Tree and an integer target, denoting the value of a node, the task is to find the sum of distances of all… Read More