## Sum of XOR of all subarrays

Given an array containing N positive integers, the task is to find the sum of XOR of all sub-arrays of the array. Examples: Input :… Read More »

## Minimum index i such that all the elements from index i to given index are equal

Given an array arr[] of integers and an integer pos, the task is to find the minimum index i such that all the elements from… Read More »

## Source to destination in 2-D path with fixed sized jumps

Given the source point and the destination point of the path and two integers x and y. The task is to check whether it is… Read More »

## Maximum length subsequence such that adjacent elements in the subsequence have a common factor

Given an array arr[], the task is to find the maximum length of a subsequence such that the adjacent elements in the subsequence have a… Read More »

## Number of strings that satisfy the given condition

Given N strings of equal lengths. The strings contain only digits (1 to 9). The task is to count the number of strings that have… Read More »

## Calculate nCr using Pascal’s Triangle

A useful application of Pascal’s triangle is the calculation of combinations. The formula to find nCr is n! / r! * (n – r)! which… Read More »

## Count all possible N digit numbers that satisfy the given condition

Given an integer N, the task is to count all possible N digit numbers such that A + reverse(A) = 10N – 1 where A… Read More »

## Maximum sub-array sum after dividing array into sub-arrays based on the given queries

Given an array arr[] and an integer k, we can cut this array at k different positions where k[] stores the positions of all the… Read More »

## Count the total number of squares that can be visited by Bishop in one move

Given the position of a Bishop on an 8 * 8 chessboard, the task is to count the total number of squares that can be… Read More »

## A modified game of Nim

Given an array arr[] of integers, two players A and B are playing a game where A can remove any number of non-zero elements from… Read More »

## Find the values of X and Y in the Given Equations

Given two numbers and . Find the values of X and Y in the equations. A = X + Y B = X xor Y… Read More »

## Find maximum operations to reduce N to 1

Given two numbers A and B ( A and B can be up to 106 ) which forms a number N = (A!/B!). The task… Read More »

## Java ArrayList to print all possible words from phone digits

Given a keypad of a mobile, and keys that need to be pressed, the task is to print all the words which are possible to… Read More »

## Find Intersection of all Intervals

Given N intervals of the form of [l, r], the task is to find the intersection of all the intervals. An intersection is an interval… Read More »

## Shortest path on a Square

Given side of a square n and two points (x1, y1) and (x2, y2) on the boundaries of the given square. The task is to… Read More »