Now I will be splitting the post and write the Hinglish version so as to properly explain the idea and every logic and how to do implementation. Few things I might not write here as those are the loopholes and way out and we can solve it but its better not to write out the loopholes here.
Also screenshots of the book for those who are interested in that conversation and its really worth it.