Problem Statement
Design a data structure that allows insert, delete and getRandomElement() in constant time i.e. O(1).
Design a data structure that allows insert, delete and getRandomElement() in constant time i.e. O(1).
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.
These 8 things most people see daily in their life.
Re-arrange the letters to see what it is?
A person forgot his 5 digit pin code, but he remembers some hints.
Can you guess the person’s pin code from above hints ?
See AnswerHide Answer
also assume, 3rd digit is y then 5th digit should be 14-y.
So the number will look like this:-
<x^2><x><y><x+1><14-y>
As we also know the sum of all digits, we can say
x^2 + 2x +1 +14 = 30 (x+1)^2 = 16 x+1 = 4 x = 3
As sum of 2nd and third digit is 10 => x+y = 10 => y=7
Thus the pin code is 93747.
You might want to try How many squares – Part 1 before you attempt these 3 puzzles.
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…]