http://www.math.uwaterloo.ca/~ccc/2000/Golf.htm
anyways, thats the problem and i solved it with a recursive functions but it takes way to long to traverse the whole tree.
anyways, i was told to look for the "knap sack problem" and "dynamic programming" on google, i did and it lead me to memoization. i know the knap sack problem is a lot like my golf problem.