Swiggy interview question

Machine coding round.