Problem Statement
Implement the function boolean isPalindrome (int n);
Which will return true if the bit-wise representation of the integer
is a palindrome and false otherwise.
Problem Statement
Implement the function boolean isPalindrome (int n);
Which will return true if the bit-wise representation of the integer
is a palindrome and false otherwise.
A girl bought a box when she was 20, She puts $250 in the box on every birthday And her sister takes out $50 from the box on her birthday. Girl died when she was 60 and when the box was opened there were $500 remaining in the box.
How is it possible?
[Read more…]
A farmer is returning from market, where he bought a she-goat, a wolf and cabbage. On the way home he must cross a river. His boat is little, allowing him to take only one of the three things. He can’t keep the she-goat and the cabbage together (because the she-goat would eat it), nor the she-goat with the wolf (because the she-goat would be eaten). How shall the farmer get everything on the other side (without any harm)?
Once a man was caught for a minor offense and was presented in king Akbar’s darbaar
Akbar wanted to test the man and said: “You must give me a statement. If it is true, you will be killed by lions. If it is false, you will be killed by trampling of wild buffalo.”
Man was not able to answer and in the end requested help from Birbal, As it was minor offense Birbal decided to help and suggested him the statement.
After hearing the statement, king Akbar had to let the man go.
Can you think of the statement that Birbal suggested?
[Read more…]
x = 0.999...
10x = 9.999...
10x - x = 9.999... - 0.999...
9x = 9
x = 1
1/3 = 0.333...
3x(1/3) = 3x(0.333...) = 0.999...
1 = 0.999...
Tina & Meena are twins. One of them lies while the other is truthful. I asked one of them,
“Does Tina lie?” “Yes”, was the answer.
Did I speak to Tina or Meena?
[Read more…]
A prisoner is faced with a decision where he must open one of two doors. Behind each door is either a lady or a tiger. They may be both tigers, both ladies or one of each.
If the prisoner opens a door to find a lady he will marry her and if he opens a door to find a tiger he will be eaten alive. Of course, the prisoner would prefer to be married than eaten alive :).
Each of the doors has a statement written on it. The statement on door one says, “In this room there is a lady, and in the other room there is a tiger.”
The statement on door two says, “In one of these rooms there is a lady, and in one of these rooms there is a tiger.”
The prisoner is informed that one of the statements is true and one is false.
Which door should the Prisoner open?
[Read more…]
Its first digit is the number of occurrence of 0’s in the number.
Second digit is the number of occurrence of 1’s in the number.
Third digit is the number of occurrence of 2’s in the number.
4th digit is the number of occurrence of 3’s in the number.
and so on up to 10th digit(which is number of occurrence of 9’s in the number).
See AnswerHide Answer