Swiggy Interview Question

Machine coding round.