Detailed video solution for the problem