LiveRamp Interview Question

how to implement the algorithm that you proposed