optimum subset works, but is horrible in time complexity