LiveRamp interview question

how to implement the algorithm that you proposed