CHEFTRIP help

What was you approach to solve Chefina and a Trip(CHEFTRIP)?

Problem link - link
contest link - link

1 Like

Reference to the editorial: