This program is used in order to find a solution where a group of people, who are all owed a certain amount of money are having trouble finding a scenario where everyone receives what they are owed.
The user sets up the scenario by creating a set of people and assigning each person the specific bills that they have, any specific bills they need in the end, and the total cash that they are owed. The only constraint is that the total money held by all the people must be equal to the total money owed, otherwise no solution is possible.
The list of people, their money owed, and their current bills possessed and bills needed is sent back to the server. The bills are then put into a pool, each person is first given the bills they require if they require any, then a recursive algorithm is called which attempts to find a solution. The base case of this algorithm is that everyone has what they are owed, this combination is then saved and displayed on the next page.
The algorithm works by assigning a person the largest bill they can be assigned, then calling itself to see if a solution can be found in the next level of scope. If it returns negative, the bill is removed and the process is repeated using the next largest bill. This method will try all possible combinations and either return the first successful combination found, or a message indicating that no possible solution exists.