Rubique Interview Question

implementation of possible splitwise logic. data structures we can use