Puzzle:
Add arithmetic operators (plus, minus, times, divide) to make the following expression true: 3 1 3 6 = 8. You can use any parentheses you’d like.
Solution:
An interviewer is asking this problem to see how you think and approach problems—so
don’t just guess randomly.
Try approaching this the following way: What sorts of operations would get us to 8?
I can think of a few:
I can think of a few:
4 * 2 = 8
16 / 2 = 8
Let’s start with the first one. Is there any way to make 3 1 3 6 make 4 * 2? We can easily notice that 3 + 1 = 4 (the first two numbers). We can also notice that 6 / 3 = 2.
If we had “3 1 6 3”, we’d be done, since (3 + 1)*(6 / 3) = 8. Although it seems a little unconventional to do this,
we can,
If we had “3 1 6 3”, we’d be done, since (3 + 1)*(6 / 3) = 8. Although it seems a little unconventional to do this,
we can,
in fact, just flip the 6 and the 3 to get the solution:
(( 3 + 1 )/ 3) * 6 = 8
Click Here To add Comment
Your feedback is always appreciated.
I will try to reply to your queries as soon as time allows.
Please do not spam Spam comments will be deleted immediately upon our review.
Blogger Widgets