code: private static JsonPointer computeRelativePath(JsonPointer path, int startIdx, int endIdx, List<Diff> diffs) {
          List<Integer> counters = new ArrayList<Integer>(path.size());
          for (int i = 0; i < path.size(); i++) {
              counters.add(0);
          }
  
          for (int i = startIdx; i <= endIdx; i++) {
              Diff diff = diffs.get(i);
              //Adjust relative path according to #ADD and #Remove
              if (Operation.ADD == diff.getOperation() || Operation.REMOVE == diff.getOperation()) {
                  updatePath(path, diff, counters);
              }
          }
          return updatePathWithCounters(counters, path);
      }
docs: Finds the longest common Ancestor ending at Array