3
shiv379
7y

Published on BBC, GCHQ have set the challenge below. Would make a fun simple coding challenge. My thought is to brute-force, is there a more efficient way to solve it?

"Take the digits 1,2,3 up to 9 in numerical order and put either a plus sign or a minus sign or neither between the digits to make a sum that adds up to 100. For example, one way of achieving this is: 1 + 2 + 34 - 5 + 67 - 8 + 9 = 100, which uses six plusses and minuses. What is the fewest number of plusses and minuses you need to do this?"

Edit: disclosure: I believe the challenge has passed already and I'm too lazy to enter anyway so don't worry about me or anyone stealing ideas!

Comments
Add Comment