Tredence interview question

Model in R