A part of techInterview.org: answers to technical interview questions.
Your host: Michael Pryor
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.
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??
Thursday, July 01, 2010
This topic is archived. No further replies will be accepted.Other recent topics
Powered by FogBugz