Category Archives: Mathematical

k-th number in the Odd-Even sequenceNovember 15, 2017

Given two numbers n and k, find the k-th number in the Odd-Even sequence made of n. The Odd-Even sequence contains first contains all odd… Read More »

Sum of all numbers divisible by 6 in a given rangeNovember 14, 2017

Given a range L-R, find the sum of all numbers divisible by 6 in range L-R L and R are very large. Examples: Input :… Read More »

Find the dimensions of Right angled triangle

Given H (Hypotenuse) and A (area) of a right angled triangle, find the dimensions of right angled triangle such that the hypotenuse is of length… Read More »

Finding the best fit rectangle that covers a given point

We are provided with a 2D plane and a point (, ). We have to find a rectangle (, , , ) such that itencompasses… Read More »

Maximum of smallest possible area that can get with exactly k cut of given rectangular

Given n×m big rectangular area with unit squares and k times cut is allowed, the cut should be straight (horizontal or vertical) and should go… Read More »

Given N and Standard Deviation, find N elements

Given N and Standard deviation find the N elements. Mean is average of element. Mean of arr[0..n-1] = ∑(arr[i]) / n where 0 <= i… Read More »

Exponential notation of a decimal number

Given a positive decimal number, find the simple exponential notation (x = a·10^b) of the given number. Examples: Input : 100.0 Output : 1E2 Explanation:… Read More »

Given a large number, check if a subsequence of digits is divisible by 8November 13, 2017

Given a number of at most 100 digits. We have to check if it is possible, after removing certain digits, to obtain a number of… Read More »

Find all possible coordinates of parallelogram

Find the all the possible coordinate from the given three coordinates to make a parallelogram of a non-zero area. Let’s call A,B,C are the three… Read More »

Total no of 1’s in numbers

Given an integer n, count the total number of digit 1 appearing in all positive integers less than or equal to n. Examples: Input :… Read More »

GCD of elements in a given range

Given two numbers n and m. Find the biggest integer a(gcd), such that all integers n, n + 1, n + 2, …, m are… Read More »

Generate a pythagoras triplet from a single integerNovember 12, 2017

Given a single integer n [1, 1000000000], generate a pythagoras triplet with includes n as of it’s sides if possible. Examples: Input : 22 Output… Read More »

Largest number with prime digits

Given a huge integer value n, find the largest integer value x such that x

Find if given number is sum of first n natural numbers

Given a number s (1 n, r = mid – 1. e) Else sum < n, l = mid + 1. 3- Return -1, if… Read More »

Smallest root of the equation x^2 + s(x)*x – n = 0, where s(x) is the sum of digits of root x.

You are given an integer n, find the smallest positive integer root of equation x, or else print -1 if no roots are found. Equation:… Read More »