title: Networking Algorithm to Maximum a Subset of Integers
body: <p>I'm currently working on a pet project that simulates a couple different types of networks. One of them requires some specific conditions that until now I've just been brute forcing. It's not scaling well, however, so I'm trying to do this efficiently but this algorithm is really stumping me! I'll try to describe the problem as general as possible.</p>
  
  <p>Given a set of integers X and an integer k, find a subset Y of X that maximizes the sum of M over each value in X:</p>
  
  <p>M(s) = the largest value in Y such that it is less than or equal to s.</p>
  
  <p>For example, for {2, 4, 5} and k = 2 the solution is {2, 4} with value 2+4+4=10 since M(2) = 2, M(4) = 4, and M(5) = 5.</p>
  
  <p>My intuition is that the solution is a dynamic programming algorithm, but I could be way off. Any help would be greatly appreciated!</p>