Not able to understand the method

could not get the code and the working as the method is very confusing

Hello @vansh22.vg what you havenot understood please tell here;
so that we can discuss.
can we try the other way if i give you my code and then you can try it with dry run yourself and then if you have any doubt we can discuss?