How to solve the problem Two Paths here?

How does one solve the second problem (Two Paths) here?

https://www.iarcs.org.in/inoi/2018/inoi2018/inoi2018-qpaper-and-cutoffs.pdf