Back to problems

Compute minimal transfers to settle group expenses

Algorithm · Google · Hard

Several friends travel together and split their costs. Every cost is stored as an object with three properties: payer, a string naming the person who fronted the entire sum; amount, an integer count of cents that was paid; and payees, an array of strings listing everyone who shares that cost in equal portions. Each name in payees owes one equal slice, and the payer may also appear in that array, which means they owe a slice of their own payment as well. Given an array of…

Checking your access…