# Category Archives: Algorithms

Given an array X[] of length N, the task is to verify whether each possible subarray has a different bitwise OR value. If possible then… Read More
Given the array X[],   the task is to return the maximum suffix sub-array length of the same elements for each distinct element and the… Read More
Given an array A consisting of N positive integers, the task is to calculate the maximum XOR of the subarray of size K consisting of… Read More
Given an array of N points in the plane, the task is to find a pair of points with the smallest distance between them, where… Read More
Given an array, arr[] containing n integers, the task is to find an integer (say K) such that after replacing each and every index of… Read More
Given a string S, the task is to print all the substrings of a string that has an equal number of vowels and consonants. Examples:… Read More
Given two integers N and M. Two players A and B are playing this game, and the task is to find the winner A or… Read More
Given an array X[] of length N. In each operation, the following task is performed: Decrement any value by 1. Replace any pair with their… Read More
Given an array arr[] of length N. Find a positive integer K such that the difference between any pair of array elements is not a… Read More
Given an array arr[] of size N, Return the number of permutations of array arr[] which satisfy the condition arr[1] & arr[2] & . .… Read More
MO’s Algorithm is an algorithm designed to efficiently answer range queries in an array in linear time. It is a divide-and-conquer approach that involves pre-processing… Read More
Given an integer N, denoting the size of a circular array containing non-zero elements and an array arr[] of size M having the indices of… Read More
Given an array arr[] of size N and an integer K, the task is to find the number of pairs in the array such that… Read More
The Mobius inversion formula is a technique used in number theory to find the inverse of an arithmetic function. It is based on the Mobius… Read More
Given an array A[] of length N, the task is to find the maximum sum calculated by multiplying subsequence sum with its length and removing… Read More