# Category Archives: Algorithms

Given two arrays A[] and B[] of size N and M respectively denoting the required elements of each group and the number of elements in… Read More
Given two force vectors, find out whether they are parallel, perpendicular or neither. Let the first vector be A = a1 i +a2 j +… Read More
When you wish to say something but miss a few characters/words, the first response that anyone gives you is “Did you mean this?“. The same… Read More
Given a tree with N nodes, an array A[] of size N denoting the value of each node and array edges [][] of size (N-1),… Read More
Given two arrays A[] and B[] of size N each, the task is to find the number of elements in array B[] that occur before… Read More
Given a 2-D array A[][] of size N × 3, where each element of the array is of the form {x, y, z}, where x,… Read More
Given an input arr[] of length N, Which contains integers from 1 to N in unsorted order. You can apply only one type of operation… Read More
Given an array A consisting of N positive integers and for any ordered triplet( i, j, k) such that i, j, and k are all… Read More
Given a set S of having numbers 1, 2, 3, . . ., N, and an integer K, the task is to form a set… Read More
Given an integer array arr[] of length N and an integer K, the task is to rearrange the elements of arr[] in such a way… Read More
Given an integer N(1 ≤ N ≤ 500), Construct an integer arr[] of length N, such that it should follow all the given conditions below: … Read More
In a party of N people, each person is denoted by an integer. Couples are represented by the same number. Find out the only single… Read More
Given an array A[] of length N, the task is to find the total number of distinct pairs (i, j) of indices where 1 ≤… Read More
Given an array A[] consisting of N elements, the task is to find the minimum length of the subarray starting from each index and the… Read More
Given an array A[] of size N such that every element is a positive power of 2. In one operation, choose a non-empty subsequence of… Read More