Java O(n) easy solution. question sounds like dp, but it is just sum of dist bw all the given points


#1
public class Solution {
    public int coverPoints(ArrayList<Integer> A, ArrayList<Integer> B) {
        int minDist = 0;
        for(int i = 1; i < A.size(); i++){
            minDist += distBetweenPoints(A.get(i-1), B.get(i-1), A.get(i), B.get(i));
        }
        return minDist;
    }
    
    public int distBetweenPoints(int c1, int r1, int c2, int r2){
        return Math.max(Math.abs(c1-c2), Math.abs(r1-r2));
    }
}