I was recently asked to calculate the money owed amongst a group of people who went on a trip together and came upon an interesting problem: given that
As one @Edd Barret stated, this can be solved approximately using linear programming.
I have written a blog post describing this approach, along with a tiny R package that implements it.