Below is the link of solution discussed in video. Ask your doubts in comments below. For more clarity, refer the solution code. For more questions like this, Like the video and Subscribe the channel for more updates
https://onecompiler.com/cpp/4487evwtx