Stripe Interview Question

OA: Implement the following algorithm to help preprocess data for fraud detection machine learning. They provide all the steps and time complexity. Turning words into code