##
Find pair with maximum GCD in an array
July 23, 2017

We are given an array of positive integers. Find the pair in array with maximum GCD. Examples: Input : arr[] : { 1 2 3… Read More »

July 23, 2017

We are given an array of positive integers. Find the pair in array with maximum GCD. Examples: Input : arr[] : { 1 2 3… Read More »

July 22, 2017

Many times while we do programming, we need to calculate the Least Common Multiple (LCM) between two numbers. We have already discussed how to find… Read More »

July 18, 2017

An evil number is a non-negative number that has an even number of 1s in its binary expansion. (Binary Expansion – is representation of a… Read More »

Image Compression : Image is stored or transmitted with having pixel value. It can be compressed by reducing the value its every pixel contains. Image… Read More »

July 16, 2017

Count the number of times a number can be replaced by the sum of its digits until it only contains one digit and number can… Read More »

July 14, 2017

A monkey is standing below at a staircase having N steps. Considering it can take a leap of 1 to N steps at a time,… Read More »

July 12, 2017

Given positive integers k, a and b we need to print last k digits of a^b ie.. pow(a, b). Input Constraint: k <= 9, a… Read More »

The Problem This problem is named after Flavius Josephus a Jewish historian who fought against the Romans. According to Josephus him and his group of… Read More »

The secant method is used to find the root of an equation f(x) = 0. It is started from two distinct estimates x1 and x2… Read More »

Given a number n. We need find the number of ordered pairs of a and b such gcd(a, b) is b itself Examples: Input :… Read More »

July 11, 2017

Given an integer n, find the last digit of this sequence, i.e. Summation of F(n) from i = 0 to 2i ≤ n, where F(n)… Read More »

Given an array of natural numbers count the sum of its proper divisors for every element in array. Input : int arr[] = {8, 13,… Read More »

July 10, 2017

Given a number n, write a program to check whether given number is Adam Number or not. Adam number is a number when reversed, the… Read More »

Given a number ‘n’ and a prime number ‘p’. We need to find out the power of ‘p’ in prime factorization of n! Examples: Input… Read More »

July 6, 2017

Given a number n, count the total number of digits required to write all numbers from 1 to n. Examples: Input : 13 Output :… Read More »