First pass solution for knapsack greedy algorithm