Can anyone tell me the approach to solve this problem? I thought of the PnC but was not able to come up with a solution. Thanks in advance.