Category Archives: Algorithm

Minimum Cost to cut a board into squares

A board of length m and width n is given, we need to break this board into m*n squares such that cost of breaking is minimum. cutting cost for each edge will be given for the board. In short we need to choose such a sequence of cutting such that cost is minimized. Examples: For… Read More »

Choice of Area

Consider a game, in which you have two types of powers, A and B and there are 3 types of Areas X, Y and Z. Every second you have to switch between these areas, each area has specific properties by which your power A and power B increase or decrease. We need to keep choosing… Read More »

Complete the sequence generated by a polynomial

Given a sequence with some of its term, we need to calculate next K term of this sequence. It is given that sequence is generated by some polynomial, however complex that polynomial can be. Notice polynomial is an expression of the following form: P(x) = a0 + a1 x +a2 x^2 + a3 x^3 ……..… Read More »

Even Fibonacci Numbers Sum

Given a limit, find the sum of all the even-valued terms in the Fibonacci sequence below given limit. The first few terms of Fibonacci Numbers are, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233 ,… (Even numbers are highlighted). Examples: Input : limit = 8 Output : 10 Explanation :… Read More »

Nth Even Fibonacci Number

Given a value n, find the n’th even Fibonacci Number. Input : n = 3 Output : 34 Input : n = 4 Output : 144 Input : n = 7 Output : 10946 The Fibonacci numbers are the numbers in the following integer sequence. 0, 1, 1, 2, 3, 5, 8, 13, 21, 34,… Read More »