# Category Archives: Algorithms

## Bitonic string

Given a string str, the task is to check if that string is a Bitonic String or not. If string str is Bitonic String then… Read More »

## Count of elements having odd number of divisors in index range [L, R] for Q queries

Given an array arr[] of N positive integers and the number of queries Q, each query contains two numbers L and R. The task is… Read More »

## Find pair with maximum GCD for integers in range 2 to N

Given a number N, the task is to find a pair of integers in the range [2, N] with maximum GCD. Examples: Input: N =… Read More »

## Find initial sequence that produces a given Array by cyclic increments upto index P

Given an array arr[] consisting of N elements and an integer P, the task is to find the initial array from which given arr[] is… Read More »

## Sum of main diagonal elements in a Matrix which are prime

Given a matrix mat[][] of R rows and C columns. The task is to find the sum of all elements from the main diagonal which… Read More »

## Minimize K whose XOR with given array elements leaves array unchanged

Given an array of N elements, the task is to find the minimum value of K such that Bitwise XOR of K with all array… Read More »

## Check given string is oddly palindrome or not

Given string str, the task is to check if characters at the odd indexes of str form a palindrome string or not. If not then… Read More »

## Count of elements which cannot form any pair whose sum is power of 2

Given an array arr[] of length N, the task is to print the number of array elements which cannot form a pair with any other… Read More »

## Count sequences of length K having each term divisible by its preceding term

Given two integer N and K, the task is to find the number of sequence of length K consisting of values from the range [1,… Read More »

## Check given string is oddly palindrome or not | Set 2

Given string str, the task is to check if characters at the odd indexes of str form a palindrome string or not. If not then… Read More »

## Maximize count of corresponding same elements in given permutations using cyclic rotations

Given two permutations P1 and P2 of numbers from 1 to N, the task is to find the maximum count of corresponding same elements in… Read More »

## Prefix Product Array

Given an array arr[] of N integers the task is to generate a prefix product array from the given array. In a prefix product array,… Read More »

## Array sum after replacing all occurrences of X by Y for Q queries

Given an integer array arr[] and Q queries, the task is to find the sum of the array for each query of the following type:… Read More »

## Maximum OR value of a pair in an Array | Set 2

Given an array arr[] of N positive elements, the task is to find the maximum bitwise OR value of a pair from the given array.… Read More »

## Largest interval in an Array that contains the given element X for Q queries

Given an array arr[] of N elements and Q queries of the form [X]. For each query, the task is to find the largest interval… Read More »