Make 3 3 7 7 equal to 24

Using only and all the numbers 3, 3, 7, 7, along with the arithmetic operations +,-,*, and /, can you come up with a calculation that gives the number 24? No decimal points allowed.

Cards in the Dark

Problem You are standing in a pitch-dark room. A friend walks up and hands you a normal deck of 52 cards. He tells you that 13 of the 52 cards are face-up, the rest are face-down. These face-up cards are distributed randomly throughout the deck. Your task is to split up the deck into two piles, using all the cards, such that each pile has the same number of face-up cards. [Read More]

Deck of cards - Pick the cards with same color

Problem  A casino offers a card game using a normal deck of 52 cards.The rule is that you turn over two cards at a time.If both of them are red,they go to your pile ;if both are black they go to dealer’s pile;and if one black and one red they are simply discarded.The process is repeated until you go through all the 52 cards.If you have more cards in your pile you will get $100,otherwise(including ties)you will get nothing. [Read More]

Triangle Formation

Problem Write a function that takes three integers corresponding to the lengths of sides and returns what kind of triangle can be made out of those 3 sides. (Equilateral, etc) You must also handle the case where no triangle may be formed from those 3 lengths. Solution We have to do following if(2 sides greater than 1){ if(a==b && b==c) // all sides equal "Equilateral triangle\\n"; else if(a==b || a==c || b==c) // at least 2 sides equal "Isosceles triangle\\n"; else // no sides equal "Scalene triangle\\n"; }else "Not a triangle"; Thanks. [Read More]

CTRL+A, CTRL+C, CTRL+V

Code given by does not give desired output.. pleas…

Anonymous - May 3, 2014

Code given by does not give desired output.. please check the code given below working fine.

int MaxCopy(int n){
int *table=(int *)malloc(sizeof(int)*(n+1));
memset(table,0,sizeof(int)*(n+1));

for(int i=0;i<=n;i++){
table[i]=i;
}
for(int i=0;i<=n;i++){
for(int j=i+4;j<=n;j++){
table[j]=max(table[j],table[i]*(j-i-2));
}
}
int res=table[n];
free(table);
return res;
}

Thanks man for fixing it. I will update it soon.

CTRL+A, CTRL+C, CTRL+V

Problem Imagine you have a special keyboard with the following keys:  A Ctrl+A Ctrl+C Ctrl+V where CTRL+A, CTRL+C, CTRL+V each acts as one function key for “Select All”, “Copy”, and “Paste” operations respectively. If you can only press the keyboard for N times (with the above four keys), please write a program to produce maximum numbers of A. If possible, please also print out the sequence of keys. That is to say, the input parameter is N (No. [Read More]

Guess the solution of selecting 4 balls from set of 4 different colors

Problem A solution consists of four balls from a set of four different colors. The user tries to guess the solution.If they guess the right color for the right spot, record it as being in the correct ‘Location’. If it’s the right color, but the wrong spot, record it as a correct ‘Color’. For example: if the solution is ‘BGRR’ and the user guesses ‘RGYY’ they have 1 ‘Location’ and 1 ‘Color’. [Read More]

Given a number 123456789, two opearators + and *, value k , find all the such expressions that evaluates to the given value k

Problem  Given a number 123456789 and two opearators + and *. You can use this two operators as many times u want. But you cant change the sequence of the number given there. The evaluated value is 2097. e.g. 1+2+345*6+7+8+9=2097 You have to find all the such expressions that evaluates and value is equal to the given value. You can use concatenation of numbers like 345 is concatenated there. [Read More]