# Category Archives: Algorithms

Given a number N, the task is to find a permutation A[] of first N integers such that the absolute difference of adjacent elements is… Read More
Given a binary string S of even size that contains only 0s and 1s, the task is to find the minimum flips (that is 0… Read More
Given an array arr[] of size N, the task is to minimize the number of distinct elements in the array after performing the following operation… Read More
A queue is a linear data structure in which insertion is done from one end called the rear end and deletion is done from another… Read More
Given an array arr[] of length N, denoting the cost of N items and the cashback upon buying that item, the task is to find… Read More
Given an N×N Matrix Mat[][] of N rows and N columns. There is exactly one Queen on the chessboard and the cell that is under… Read More
Given an array arr[] of length N, the task is to find the total number of elements that has frequency 1 in a subarray of… Read More
Geek has N packs of chocolates and the amount of chocolates in each pack is given in an array arr[]. His sister wants to have… Read More
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