EXPEDI LOGIC HELP | CCDSAP ADVANCED PREPARATION

problem ID: EXPEDI

I am not able to think the logic of the question plz help.

I don’t want implementation but the logic and pattern to solve such questions in a short period of time