##
Count Possible Decodings of a given Digit Sequence
July 15, 2014

Let 1 represent ‘A’, 2 represents ‘B’, etc. Given a digit sequence, count the number of possible decodings of the given digit sequence.

July 15, 2014

Let 1 represent ‘A’, 2 represents ‘B’, etc. Given a digit sequence, count the number of possible decodings of the given digit sequence.

July 1, 2014

This problem is know as Clock angle problem where we need to find angle between hands of an analog clock at a given time.

June 9, 2014

Given a number ‘n’, find the smallest number ‘p’ such that if we multiply all digits of ‘p’, we get ‘n’. The result ‘p’ should… Read More »

June 2, 2014

You are given a function rand(a, b) which generates equiprobable random numbers between [a, b] inclusive. Generate 3 numbers x, y, z with probability P(x),… Read More »

May 28, 2014

Given a polynomial of the form cnxn + cn-1xn-1 + cn-2xn-2 + … + c1x + c0 and a value of x,

May 27, 2014

We can use a for loop to find sum.

Following is simple program to print first n Fibonacci numbers. Recommended: Please solve it on “PRACTICE ” first, before moving on to the solution. Output:… Read More »

May 24, 2014

Factorial of a non-negative integer, is multiplication of all integers smaller than or equal to n. For example factorial of 6 is 6*5*4*3*2*1 which is… Read More »

LCM (Least Common Multiple) of two numbers is the smallest number which can be divided by both numbers.

GCD (Greatest Common Divisor) or HCF (Highest Common Factor) of two numbers is the largest number that divides both of them.

May 12, 2014

Given an integer n, write a function that returns count of trailing zeroes in n!.

May 11, 2014

Catalan numbers are a sequence of natural numbers that occurs in many interesting counting problems like following.

December 20, 2013

Given a positive integer n, generate all possible unique ways to represent n as sum of positive integers.

December 15, 2013

Given two integers, write a function to multiply them without using multiplication operator.

October 14, 2013

Given a number ‘n’, how to check if n is a Fibonacci number. First few Fibonacci numbers are 0, 1, 1, 2, 3, 5, 8,… Read More »