Problem link :-pdf file (2nd problem)
My solution :-Solution
Please help Me out, spent a lot of time.