I was trying to solve Another Problem On Strings using two pointers since it was mentioned in its tags but I am not getting an idea of it. I have solved it by using hashing and binary search by considering the prefix sum. It will be helpful if one can give some idea of approaching it with two pointers.
Let
calculating both are a trivial two pointer exercises.
Now answer is Sum(pnt1[i] — pnt2[i]) for all i = [0, len-1].
How to solve it by dp? It has 'dp' tag too.