Tredence Interview Question

Model in R