# Category Archives: Algorithms

## Count All Palindromic Subsequence in a given String

Find how many palindromic subsequence (need not necessarily be distinct) can be formed in a given string. Note that the empty string is not considered… Read More »

## Bitwise and (or &) of a range

Given two non-negative long integers, x and y given x <= y, the task is to find bit-wise and of all integers from x and… Read More »

## Calculate XOR from 1 to n.

Given a number n, the task is to find the XOR from 1 to n. Examples : Input : n = 6 Output : 7… Read More »

## Print all longest common sub-sequences in lexicographical order

You are given two strings.Now you have to print all longest common sub-sequences in lexicographical order? Examples: Input : str1 = “abcabcaa”, str2 = “acbacba”… Read More »

## Multiples of 4 (An Interesting Method)

Given a number n, the task is to check whether this number is a multiple of 4 or not without using +, -, * ,/… Read More »

## Maximum weight path ending at any element of last row in a matrix

Given a matrix of integers where every element represents weight of the cell. Find the path having the maximum weight in matrix [N X N].… Read More »

## Maximum height when coins are arranged in a triangle

We have N coins which need to arrange in form of a triangle, i.e. first row will have 1 coin, second row will have 2… Read More »

## Prime factors of LCM of array elements

Given an array arr[] such that 1 <= arr[i] <= 10^12, the task is to find prime factors of LCM of array elements. Examples: Input… Read More »

## Remainder with 7 for large numbers

Given a large number as a string, find the remainder of number when divided by 7. Examples : Input : num = 1234 Output :… Read More »

## GCD, LCM and Distributive Property

Given three integers x, y, z, the task is to compute the value of GCD(LCM(x,y), LCM(x,z)). Where, GCD = Greatest Common Divisor, LCM = Least… Read More »

## Minimum edges to reverse to make path from a source to a destination

Given a directed graph and a source node and destination node, we need to find how many edges we need to reverse in order to… Read More »

## Multiply a number with 10 without using multiplication operator

Given a number, the task is to multiply it with 10 without using multiplication operator? Examples: Input : n = 50 Output: 500 // multiplication… Read More »

## Number of permutation with K inversions

Given an array, an inversion is defined as a pair a[i], a[j] such that a[i] > a[j] and i < j. We are given two… Read More »

## Program to find the Type of Triangle from the given Coordinates

We are given coordinates of a triangle. The task is to classify this triangle on the basis of sides and angle. Examples: Input: p1 =… Read More »

## Disarium Number

Given a number “n”, find if it is Disarium or not. A number is called Disarium if sum of its digits powered with their respective… Read More »