# Category Archives: Algorithms (adsbygoogle = window.adsbygoogle || []).push({});

## Count number of common elements between two arrays by using Bitset and Bitwise operation

Given two arrays a[] and b[], the task is to find the count of common elements in both the given arrays. Note that both the… Read More »

## Find the radii of the circles which are lined in a row, and distance between the centers of first and last circle is given

Given here are n circles which touch each other externally, and are lined up in a row. The distance between the centers of the first… Read More »

## Find the side of the squares which are lined in a row, and distance between the centers of first and last square is given

Given here are n squares which touch each other externally, and are lined up in a row. The distance between the centers of the first… Read More »

## Find the Kth smallest element in the sorted generated array

Given an array arr[] of N elements and an integer K, the task is to generate an B[] with the following rules: Copy elements arr[1…N],… Read More »

## Number of triangles formed by joining vertices of n-sided polygon with one side common

Given N-sided polygon we need to find the number of triangles formed by joining the vertices of the given polygon with exactly one side being… Read More »

## Count pairs with set bits sum equal to K

Given an array arr[] and an integer K, the task is to count the pairs whose sum of set bits is K Examples: Input: arr[]… Read More »

## Minimum operations to make sum of neighbouring elements <= X

Given an array arr[] of N elements and an integer X, the task is to find the minimum number of operations required to make sum… Read More »

## Queries for number of distinct elements from a given index till last index in an array

Given a array ‘a[]’ of size n and number of queries q. Each query can be represented by a integer m. Your task is to… Read More »

## Sort the character array based on ASCII % N

Given an array arr[] of characters and an integer M, the task is to sort the array based on ASCII % M i.e. the character… Read More »

## Program to calculate area of inner circle which passes through center of outer circle and touches its circumference

Given a circle C1 and it’s a radius r1. And one another circle C2 whose passes through center of circle C1 and touch the circumference… Read More »

## Convert many to many mappings to maximum no of one to one mappings

Given an array arr1 containing integers from 1..N and another array arr2 containing integers from 1..M. Each element of arr1 is mapped to more than… Read More »

## Total number of possible Binary Search Trees using Catalan Number

Given an integer N, the task is to count the number of possible Binary Search Trees with N keys. Examples: Input: N = 2 Output:… Read More »

## Check whether an array can be made strictly decreasing by modifying at most one element

Given an array arr[] of positive integers, the task is to find whether it is possible to make this array strictly decreasing by modifying at… Read More »

## Order of indices which is lexicographically smallest and sum of elements is <= X

Given an array arr[] and an integer X, the task is to find the indices such that: The sum of elements on the found indices… Read More »

## Find the node with maximum value in a Binary Search Tree using recursion

Given a Binary Search Tree, the task is to find the node with maximum value. Examples: Input: Output: 22 Recommended: Please try your approach on… Read More »