Question: You are given a puzzle like this: 7 __ 10 __ 2 lank may be filled with a + (plus) or - (minus), producing a
You are given a puzzle like this:
7 __ 10 __ 2
lank may be filled with a + (plus) or - (minus), producing a value k. For all
combinations of plus and minus, find the value of k that is closest to 0.
In the above case, there are 4 combinations, each producing a different value:
7 + 10 + 2 = 19
7 + 10 - 2 = 15
7 - 10 + 2 = -1
7 - 10 - 2 = -5
Of all these combinations, the value that is closest to zero is -1
. So the answer is -1
. If
there is more than one number that is closest, print the absolute value.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
