Skip to main content
1 of 4
Max Alekseyev
  • 34.3k
  • 5
  • 74
  • 152

I'm afraid this is not possible unless P=NP. If one can solve your problem in polynomial time, then using this solution and binary search, it would be possible to solve the Subset Sum problem in polynomial time as well. But the latter problem is NP-complete.

Max Alekseyev
  • 34.3k
  • 5
  • 74
  • 152