You have 8*8 square grid with left-bottom and right-top squares removed. (thus there are only 62 squares remaining in the grid). You are given 31 tiles each of 2*1. You have to put the tiles on the grid without breaking any of the tiles (so that all squares of the grid are covered). How will you do that?
Hint: It is impossible to do that, prove :)
Generalize the result for 2n*2n grid. What is the case with (2n+1)*(2n+1) grid and (2n)*(2m+1) grid?
given a triangle ABC, how would you use only a compass and a straight edge to find a point P such that triangles ABP, ACP & BCP have equal perimeters?(Assume that ABC is constructed so that a solution does exist)
#
Say we have a data structure as follows:
enum {RED,BLUE,GREEN};
struct Ball
{
/*...*/
int color;
};
int ColorOfBall(Ball b)
{
return b.color;
}
Ball arr[SIZE];
The array arr consists of balls of with one of the three colours
(Red,Green,Blue). Now we need to sort the array in such a way that all
the Red coloured balls come first, followed by blue and then green.
The restriction is that call to function ColorOfBall is a very costly
operation. You have to use it as less as possible. (In other words we
would be looking for the solution with least number of calls to the
function ColorOfBall.)
There is an array A[N] of N numbers. You have to compose an array Output[N] such that Output[i] will be equal to multiplication of all the elements of A[N] except A[i]. For example Output[0] will be multiplication of A[1] to A[N-1] and Output[1] will be multiplication of A[0] and from A[2] to A[N-1].
Solve it without division operator and in O(n).
There are 25 horses and 5 lanes. You have no idea about which horse is better than other. Find in minimum possible races, the first three fastest running horses.
Mr. X meet Mr. Y during an early morning walk.
Mr Y asks the age of Mr. X's children and Mr. X is a math professor so gives Mr Y a problem to solve.
Mr X says
-> I have 3 children
-> The product of their ages is 36
-> The sum of their age is equal to the number of houses in my street.
-> And my first daughter has blue eyes.
Using these clues Mr Y was able to say the ages of the 3 children.
In Russia you get into a bus, take a ticket, and sometimes say : Wow, a lucky number! Bus tickets are numbered by 6-digit numbers, and a lucky ticket has the sum of 3 first digits being equal to the sum of 3 last digits. When we were in high school (guys from math school No. 7 might remember that ) we had to write a code that prints out all the lucky tickets' numbers; at least I did, to show my loyalty to the progammers' clan. Now, if you add up all the lucky tickets' numbers you will find out that 13 (the most unlucky number) is a divisor of the result. Can you prove it (without writing a code)?
A bank has a collection of n bank cards that they’ve confiscated, suspecting them of being used in a fraud. Each bank card corresponds to a unique account in the bank. Each account can have many cards corresponding to it, and we’ll say that two bank cards are equivalent if they correspond to the same account. The only way to say 2 cards are equivalent is by using a high-tech “equivalence-tester” that takes in 2 cards, and after performing some computations, determines whether they are equivalent.
Their question is the following: among the collection of n cards, is there a set of more than n/2 of them that are all equivalent to one another? Assume that the only feasible operations you can do with the cards are to pick two of them and plug them in to the equivalence tester. Answer in O(n)