# Category Archives: Mathematical

## Biggest number by arranging numbers in certain orderMay 27, 2017

Given an array of n numbers. Arrange them in a way that yields the largest value. While arranging the order of even numbers with respect… Read More »

## Find the n-th number made of even digits only

Given a number n, find out the n-th positive number made up of even digits (0, 2, 4, 6, 8) only. Firs few numbers made… Read More »

## Converting a Real Number (between 0 and 1) to Binary StringMay 26, 2017

Given a real number between 0 and 1 (e.g., 0.72) that is passed in as a double, print the binary representation. If the number cannot… Read More »

## Queries for GCD of all numbers of an array except elements in a given range

Given an array of n numbers and a number of queries are also given. Each query will be represented by two integers l, r. The… Read More »

## An efficient way to check whether n-th Fibonacci number is multiple of 10May 24, 2017

We are given a variable n, we need to find whether Fibonacci number will be multiple of 10 or not. Examples: Input : 15 Output… Read More »

## Fizz Buzz ImplementationMay 23, 2017

Fizz Buzz is a very simple programming task, asked in software developer job interviews. A typical round of Fizz Buzz can be: Write a program… Read More »

## Primality Test | Set 4 (Solovay-Strassen)May 22, 2017

We have already been introduced to primality testing in the previous articles in this series. Primality Test | Set 1 (Introduction and School Method) Primality… Read More »

## Check if a large number is divisible by 25 or notMay 21, 2017

Given a number, the task is to check if number is divisible by 25. The input number may be large and it may not be… Read More »

## Check a large number is divisible by 16 or not

Given a number, the task is to check if a number is divisible by 16 or not. The input number may be large and it… Read More »

## Find Index of given fibonacci number in constant timeMay 20, 2017

We are given a Fibonacci number. First few Fibonacci numbers are 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, …..… Read More »

## Print prime numbers in a given range using C++ STL

Generate all prime numbers between two given numbers. The task is to print prime numbers in that range. The Sieve of Eratosthenes is one of… Read More »

## Date after adding given number of days to the given dateMay 17, 2017

Given a date and a positive integer x. The task is to find date after adding n days to the given date Examples: Input :… Read More »

## Determine whether a given number is a Hyperperfect Number

Given a number, determine whether it is a valid Hyperperfect Number. A number n is called k-hyperperfect if: n = 1 + k ∑idi where… Read More »

## Using Chinese Remainder Theorem to Combine Modular equationsMay 16, 2017

Given N modular equations: A ≅ x1mod(m1) . . A ≅ xnmod(mn) Find x in the equation A ≅ xmod(m1*m2*m3..*mn) where mi is prime, or… Read More »

## Given a number n, find the first k digits of n^n

Given a number n, find the first k digits of nn, where k is a value less than the number of digits in nn Input… Read More »