finds the Maximum sum of a subset from a Array