
I think I have answered the question correctly, but it took around 45 min for me to fully understand and solve the question.
Please give me a generalized formula that can be applied to the scenarios like the one in the question, so that we can save time.
thanx 