https://online.codingblocks.com/player/5104/content/323?s=632
How to solve this
Refer the solution here - (start from 9.00 mins)