I highly suggest my viewers to go through the problem statement and try this problem on their own.If you are able to solve,that's good you can watch my video,but,if not,then you can learn a lot from this problem.
Prerequisites: Trie data structure.