Hi all,
I'm looking all day for algorithm that sums all given numbers to match the result.
For example :
user input : (6 numbers) 2, 5, 3, 5, 20, 100. And wanted result is 400.
So 20/5*100 = 400 ( and only can use each number one time only )
You can use all math operators + , - , * , / and ( ) ;
Is there any method which can solve this problem ?
Thanx in advance .
This seems like a generalization of the game "24", which in turn seems like a generalization of the subset sum problem, which is NP-complete.
So I feel like this might be a hard problem to solve efficiently.
Unfortunately, I don't have a brute-force (or otherwise) algorithm for any of these, either....