It's the same with software engineering, being able to reason about possible bugs just by looking at some code comes from training/experience.
Now, on this problem, some train of thought is like this:
100 people join of their own free will, no limit other then value-from-waiting > value-from-not-waiting.
If extra coffeee then valueFromWaiting - valueFromNot = 75c. Cost per person 0.25c
But... this means more people queue up ontil valueFromWaiting - valueFromNot = 0. (basic economy knowlege being tested)
So what's the grand cost and how come it's 100$?, well, I could argue that
Sum(1$ - valueForPerson(i)) from 1 to NewEquilibriumPersonCount == Sum(1$) from 1 to OldPersonCount.
Because NewEquilibriumPersonCount is function of ValuePerPerson. (can probably deduce how given some time or some reading would help)
Grasping this sort of logic is when GPT will be scary.
It's a mind-reading game of which assumptions the professor/interviewer wants to keep solid which ones are open to change.