Rubique interview question

implementation of possible splitwise logic. data structures we can use