Food for Brain

Three turtles are lined up in a row. The first turtle said, "I've got 2 turtles behind me and no turtles in front of me." The second turtle said: "I've got 1 turtle behind me and 1 turtle in front of me." but the last turtle surprised the other two and said, "I've got 2 turtles behind me and 2 turtles in front of me."

How is that possible?
The last turtle had lied.

Change the position of only one number in the sequence given below in order that the amended sequence corresponds to a palindromic sequence.

1, 4, 9, 6, 2, 1, 5, 10, 4

A. -> We shift the number 2 to the last position, giving the sequence:
1, 4, 9, 6, 1, 5, 10, 4, 2

When each term of the amended sequence is converted to Roman Numerals; without commas it reads as:

IIVIXVIIVXIVII.

The above sequence is clearly palindromic as sought for in the problem.

B.-> If you move the 1 from the beginning to the end, and rewrite the numbers as Roman numerals you get:

IV IX VI II I V X IV I

which is a palindrome.


I want to inscribe letters on to nine cubical wooden blocks to be able to spell all the months of the year. For good appearance, I do not want to use the end grain of any block. That leaves four sides of the blocks to use, which is plenty. I also want one blank face (not end grain) on each block.
Is it possible to assign three letters to each block to spell out all twelve months, without resorting to tricks like inverting an 'n' to make a 'u'?

1 2 3 4 5 6 7 8 9
S E P T E M B E R
D N C Y L A A H O
R F J V G O I U U

3628794 25798614 67938 63175 674 3825 3854
JANUARY FEBRUARY MARCH APRIL MAY JUNE JULY

785914 123456789 6349751 29456781 12356789
AUGUST SEPTEMBER OCTOBER NOVEMBER DECEMBER


you have two identical crystal orbs. you need to figure out how high an orb can fall from a 100 story building before it breaks. you know nothing about the toughness of the orbs: they may be very fragile and break when dropped from the first floor, or they may be so tough that dropping them from the 100th floor doesn't even harm them.

what is the largest number of orb-drops you would ever have to do in order to find the right floor? (i.e. what's the most efficient way you could drop the orbs to find your answer?)

you are allowed to break both orbs, provided that in doing so you uniquely identify the correct floor.

14.

Drop first orb from floors 14, 27, 39, 50, 60, 69, 77, 84, 90, 95, 99, 100... (ie move up 14 then 13, then 12 floors, etc) until it breaks (or doesn't at 100). Call the first floor at which it breaks n and the previous tested floor n'. Then try the intervening floors (n'+1 .. n'-1) with the other orb.

Worst case is if correct floor is 13,14,26,27, etc which require m drops with the first orb and 14-m drops with the second.



i flip a penny and a dime and hide the result from you. "one of the coins came up heads", i announce. what is the chance that the other coin also came up heads?

Assuming complete honesty on the part of the flipper, wouldn't the solution be 33%?

There are four possible scenarios:

HH
TH
HT
TT

Obviously the TT possibility can be discounted because it does not result in one of the two being heads.

This lees us with three possibilities, only one of which has the other coin also being heads.

Therefore one third.



part I: what is the angle between the minute hand and the hour hand at 3:15 on an analog clock? no, its not 0.
-->part I: 12 hours on the clock make 360 deg. so one hour is 30 deg. the hour hand will be directly on the 3 when the minute hand is at 12 (3:00). after 15 minutes or 1/4 of an hour, the hour hand will be 1/4 * 30 deg = 7.5 deg. away from the minute hand.

part II: how often does the minute hand pass the hour hand on an analog clock?
-->part II: if you just think about it, intuitively you'll see the minute hand passes the hour hand 11 times every 12 hours, so it must pass it every 1 1/11 hours. but this doesn't make sense to me. i need to prove it.
if x is our answer then every x hours, the minute hand and the hour hand will be right on top of each other. every hour the hour hand travels 5 units. so between every time that the minute and the hour hand meet, the hour hand will go 5*x units. every hour the minute hand travels 60 units, so it will have gone 60*x units.

what we're trying to find is the distance traveled by the minute hand to reach the hour hand, once the minute hand has looped around once. consider its 12:00. both hands in the same position. after an hour, minute hand is on 12, hour hand on 1 (its traveled 5 units). now in the time it takes the minute hand to catch up to the hour hand it will travel a little bit further.

we only need to find x where 5*x = 60*(x-1), since the real distance traveled by the minute hand, from where it started to where it ends, is 60*(x-1). the first hour just puts it back where it started, so we're only concerned with the extra part it traveled to reach the hour hand.


5x = 60(x-1)
5x = 60x - 60
60 = 55x
60/55 = x
there it is. the answer is 60/55 hours, or every 1 and 1/11 hours



reverse a string, in place". if you understand pointers, the solution is simple. even if you don't, it can be accomplished using array indices. i usually ask candidates this question first, so they get the algorithm in their head. then i play dirty by asking them to reverse the string word by word, in place. for example if our string is "the house is blue", the return value would be "blue is house the". the words are reversed, but the letters are still in order (within the word).
-->solving the initial problem of just reversing a string can either be a huge help or a frustrating hinderance. most likely the first attempt will be to solve it the same way, by swapping letters at the front of the string with letters at the back, and then adding some logic to keep the words in order. this attempt will lead to confusion pretty quickly.

for example, if we start by figuring out that "the" is 3 letters long and then try to put the "t" from "the" where the "l" from "blue" is, we encounter a problem. where do we put the "l" from "blue"? hmm... well we could have also figured out how long "blue" was and that would tell us where to put the "l" at... but the "e" from "blue" needs to go into the space after "the". argh. its getting quite confusing. in fact, i would be delighted to even see a solution to this problem using this attack method. i don't think its impossible, but i think it is so complex that it's not worth pursuing.

here's a hint. remember before when we just reversed "the house is blue"? what happened?


initial: the house is blue
reverse: eulb si esuoh eht
look at the result for a minute. notice anything? if you still don't see it, try this.


initial: the house is blue
reverse: eulb si esuoh eht
wanted : blue is house the
the solution can be attained by first reversing the string normally, and then just reversing each word.