City Tour Interviewbit

Can someone please explain the solution approach to this problem?

refer this

1 Like