techInterview Discussion

A part of techInterview.org: answers to technical interview questions.

Your host: Michael Pryor

now i have four 4's you can any thing +,-,*,/  but ans=20

try in any way you want
supraja Send private email
Wednesday, June 23, 2010
 
 
*yawn* paging Gene...
d Send private email
Wednesday, June 23, 2010
 
 
Here I am, d.  Having graduated earlier this month with a minor in Math, I swiftly despatch the nasty dragon^Wmath problem.

4 * (4 + 4 / 4)

All better?

Sincerely,

Gene Wirchenko
techInterview Moderator (and very small dragon killer)
Gene Wirchenko Send private email
Wednesday, June 23, 2010
 
 
I was thinking delete button but whatever.
d Send private email
Wednesday, June 23, 2010
 
 
I know, d.  A problem like this is actually much better than many of those posted here.  If I were to ask it though, I would want to know how someone would go about solving such a problem.  That would be more valuable to me than knowing that the candidate could solve the particular problem.

Sincerely,

Gene Wirchenko
Gene Wirchenko Send private email
Thursday, June 24, 2010
 
 
The way I would approach a qustion would be to factor the required number,i.e., 20=2*2*5 or 4*5(Divide & Conquer)
So now the problem is divided in to 2 parts (4 & 5)

Now I have a 4, so now I am required to generate a 5 using three 4's. I try to generate a 5 by dividing it again into 4+1 since we have a 4 with us. The problem now comes down to generating a 1 using two 4's which can be done by 4/4, and now the problem is solved.
I could solve the problem in abt 5 min's, but there are many many more such number puzzles which are very diffcult to solve and require other complex operations like root, power, etc. So would you use the same procedure of divide & conquer or is there some other better way to approach such problems??
Sachin
Thursday, July 01, 2010
 
 
if few more mathematical operators allowed then ...

1. (44 - 4)/sqrt(4)
2. (4!) - 4 - 4 + 4
3. (4 + 4 + sqrt(4) ) * (sqrt(4))
4. (sqrt(4)^sqrt(4)^sqrt(4)) + 4
.
.
gun0m gun0m Send private email
Monday, August 02, 2010
 
 
visit http://www.cracktheinterview.org/ for good collection of interview questions
Polisetti Send private email
Tuesday, August 17, 2010
 
 

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics
 
Powered by FogBugz