Megogo interview question

Test assignment with explaining my approach